DevExpress GridControl 按列值定位(选择)对应行

方法一:

int rowHandle = gridView.LocateByValue("CustomerID", 12345);

if(rowHandle != DevExpress.XtraGrid.GridControl.InvalidRowHandle)

gridView.FocusedRowHandle = rowHandle;

 

方法二:

int result = DevExpress.XtraGrid.GridControl.InvalidRowHandle;
for (int i = 0; i < gvNotice.RowCount; i++)
if (Equals(noticeId, gvNotice.GetRowCellValue(i, "ACCOUNTNOTICEID")))
{
result = i;
break;
}
if (result != DevExpress.XtraGrid.GridControl.InvalidRowHandle)
{
gvNotice.FocusedRowHandle = result;
gvNotice.SelectRow(result);
}

 

posted @ 2020-07-25 13:49  千年海岩  阅读(1235)  评论(0编辑  收藏  举报