How to get the selected row values of DevExpress XtraGrid?

The Solution to How to get the selected row values of DevExpress XtraGrid? is


Here is the way that I've followed,

int[] selRows = ((GridView)gridControl1.MainView).GetSelectedRows();
DataRowView selRow = (DataRowView)(((GridView)gridControl1.MainView).GetRow(selRows[0]));
txtName.Text = selRow["name"].ToString();

Also you can iterate through selected rows using the selRows array. Here the code describes how to get data only from first selected row. You can insert these code lines to click event of the grid.

~ Answered on 2013-02-15 16:52:11


Most Viewed Questions: