How to get a list of items, that is in sorted gridControl?
I need to create a new List with only values, sorted by GridControl.
How to get a list of items, that is in sorted gridControl?
I need to create a new List with only values, sorted by GridControl.
probably not the most elegant solution but as found on the devexpress site because i hit the same problem a while a go:
the main gridview of the gridcontrol has a property DataRowCount, so you could do this;
List<DataRow> dataRows = new List<DataRow>();
for (int i = 0; i < gridView1.DataRowCount; i++) {
DataRow row = gridView1.GetDataRow(i);
dataRows.Add(row);
}
and then you can do whatever, or select a value from the row before you add it to an collection while using the column header:
object result = gridview1.GetDataRow(i)["ID"];