DevExpress中绑定信息列表时,列字段如何再绑定方法

GridView.CustomDrawCell事件可以对GridView展示的列进行处理.

gridView1.CustomDrawCell += gridView1_CustomDrawCell;

void gridView1_CustomDrawCell(object sender, DevExpress.XtraGrid.Views.Base.RowCellCustomDrawEventArgs e)
        {
            if (e.Column.FieldName == "Status")
            {
               

               if (e.CellValue != null)
                {
                    string s = e.CellValue.ToString();
                    switch (e.CellValue.ToString())
                    {
                        case "True": e.DisplayText = "是"; break;
                        case "False": e.DisplayText = "否"; break;
                        default: break;
                    }
                }
            }
                     
        }

//获得选中行的某列值

 gridView1.GetDataRow(gridView1.FocusedRowHandle)["ID"].ToString();

猜你喜欢

转载自blog.csdn.net/lybwwp/article/details/12079785