Question

Is there an easy way to convert an infragistics UltraGridRow to a standard DataRow object?

Was it helpful?

Solution

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

OTHER TIPS

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.

Use the ListObject property of the UltraGridRow to get at the underlying data item.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top