DevExpress gridView 获取指定列,指定行,焦点行数据
1. grid 数据行数问题
gridView1.DataRowCount;
efDevGrid1.EFChoiceCount;
System.Data.DataTable srcTable = efDevGrid1.GetSelectedDataRow();
srcTable.Rows.Count;
2. 获取指定行、选中行字段(列)的值
gridView1.GetRowCellValue(idx, "USER_NAME").ToString().Trim();
gridView1.SetRowCellValue(idx, "USER_NAME", "秦始皇");
System.Data.DataTable dt = efDevGrid1.GetSelectedDataRow();
string userName = dt.Rows[idx]["USER_NAME"].ToString().Trim();
string user_name = efDevGrid1.GetSelectedDataRow()[idx]["USER_NAME"].ToString().Trim();
3. 列名称获取
string colName = gridView1.Columns[idx].FieldName.ToString();
string colname = gridView1.Columns[idx].Name;
string colType = gridView1.Columns[idx].ColumnType.Name;
System.Data.DataTable srcTable = new System.Data.DataTable();
string colname = srcTable.Columns[0].ColumnName;
4. 获取、设置焦点行数据
string userName = gridView1.GetFocusedRowCellValue("USER_NAME").ToString().Trim();
gridView1.SetFocusedRowCellValue("USER_NAME", "商鞅");
int rowHandle = gridView1.FocusedRowHandle;
efDevGrid1.SetSelectedColumnChecked(gridView1.FocusedRowHandle, true);
efDevGrid.GetSelectedColumnChedked(idx);