C# Dev GridView当前行

 DEV获取GridControl当前行

//直接通过gridView获取当前行
dr=this.gridView1.GetDataRow(this.gridView1.FocusedRowHandle);
//通过DataSet获取数据,需要转换行标
dr = ds.Tables[0].Rows[this.gridView1.ViewRowHandleToDataSourceIndex(e.FocusedRowHandle)];
//通过数据绑定获取
gridcontrol1.DataSource = dt;
dr = ds.Tables[0].Rows[dt.Position];

int selectRow = gridView1.GetSelectedRows()[0];
 string id = this.gridView1.GetRowCellValue(selectRow, "id").ToString();

 

posted @ 2021-05-08 14:35  lybingyu  阅读(837)  评论(0编辑  收藏  举报