记录DEV gridview获取行列数据方法

时间:2021-08-13 06:14:06
DataRow dr = this.gridView1.GetDataRow(this.gridView1.FocusedRowHandle);//获取选中行
string str = gridView1.GetFocusedRowCellValue("PEBID").ToString();//获取某一行的指定列的值

  获取每行指定列的数据(可处理批量选择)

List<int> selectRows;
List<int> custcode = new List<int>();
selectRows = this.gridView1.GetSelectedRows().ToList();
foreach (int i in selectRows)
{
custcode.Add(int.Parse(this.gridView1.GetDataRow(i)["PEBID"].ToString()));
}