1. 程式人生 > >DevExpress中繫結資訊列表時,列欄位如何再繫結方法

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();