I use DevExpress controls - I have a GridControl and a built-in GridView - I download the data from the database - sqlDataSource.
I want to select a row in a grid and then display a column value of 1 from the selected record.
How to do it?
The following code returns an empty field.
int savedRowIndex;
savedRowIndex = gridView1.FocusedRowHandle;
var test1 = gridView1.GetRowCellValue(savedRowIndex, "columnName");
MessageBox.Show(test1.ToString());
or...
private void gridView1_RowCellClick(object sender, DevExpress.XtraGrid.Views.Grid.RowCellClickEventArgs e)
{
textBox1.Text = gridView1.GetRowCellValue(gridView1.FocusedRowHandle, "colName").ToString();
}
Doesn't work.
I solved the problem.
var strRow = grid.GetRowCellValue(grid.FocusedRowHandle, grid.Columns[0]).ToString();
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.