通過列名獲取選中行的ID
private string GetSelectID(string FileName)
{
int[] pRows = this.gdv.GetSelectedRows();//傳遞實體類過去 獲取選中的行
if (pRows.GetLength(0) > 0)
return gdv.GetRowCellValue(pRows[0], FileName).ToString();
else
return null;
}
GetSelectID(string FileName)//調用的時候直接傳入想要獲取的單元格的列名
獲取實體類
List<EntityEmployee> entityEmployees = new List<EntityEmployee>();
var list = gridControl.DataSource as List<EntityEmployee>;獲取到當前GridControl中綁定的數據源List<EntityEmployee>;
if (list == null || list.Count == 0) { return; }判斷獲取到的list集合是否為空
entityEmployees = list.FindAll(t => t.IsUpdate);在按條件進行篩選得到實體類