Thursday, August 27, 2009

To get a value of a cell of focused row of XtraDatagrid in C#

Before I used the code below to get cell value of XtraDatagrid.

string
FirstName = gridView1.GetFocusedDataRow().ItemArray[2].ToString();
But in this case I must know the index of fields in Datasource. it is very difficult in very big tables.


Now I found very way to get a value of a cell of focused row of XtraDatagrid.

DataRow
DR = gridView1.GetDataRow(gridView1.FocusedRowHandle);
string FirstName = DR["FIRSTNAME"].ToString();

0 comments: