Reputation: 7258
Is there an easy way to convert an infragistics UltraGridRow
to a standard DataRow
object?
Upvotes: 3
Views: 8188
Reputation: 6094
Use the ListObject property of the UltraGridRow to get at the underlying data item.
Upvotes: 0
Reputation: 216293
If you have set the DataSource of your UltraGrid to a DataTable then you could extract the underlying DataRow of the current ActiveRow using
if(grid.ActiveRow != null && grid.ActiveRow.IsDataRow)
{
DataRow row = (grid.ActiveRow.ListObject as DataRowView).Row;
}
Of course you could subst the ActiveRow of this example with every UltraGridRow where the IsDataRow property is true (beware of the SummaryRows and the OutlookGroupByRow)
Notice that if you bind to the DataSource a List<CustomClass>
then the ListObject
is able to return the single instance of the CustomClass
Upvotes: 7
Reputation: 624
If I remember correctly, you can access the underlying DataRow
via:
var myDataRow = ((DataRowView)myUltraGridRow.ListObject).Row;
given the precondition that your grid.DataSource object is a DataTable or DataSet.
Upvotes: 2