Reputation: 37
I try to pass the value to DataRow type variable from custom collection like the codes bellow:
GridHitInfo downHitInfo = null;
DataRow row = gridView3.GetDataRow(downHitInfo.RowHandle);
But as I know that if the view's data source is a custom collection of objects, the GetDataRow
method returns null
(Nothing in Visual Basic). If the view's data is supplied by the System.Data.DataTable
or System.Data.DataView object
, the System.Data.DataRow object
representing a specific row is returned."
And the XPCollection is "a custom collection of objects".
Is there any way that I could do to get the value from
gridView3.GetDataRow(downHitInfo.RowHandle)?
Is there any converter or something needed?
Upvotes: 3
Views: 1346
Reputation: 17848
You can't get the DataRow object when the underlying Grid's data source not is DataTable or DataView. When the data source's type is XPCollection you should use the GetRow() method instead of the GetDataRow() method to get objects which correspond to grid rows:
var xpCollection = new XPCollection<Person>();
gridControl1.DataSource = xpCollection;
//...
Person person = (Person)gridView1.GetRow(rowHandle);
Upvotes: 1