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

有帮助吗?

解决方案

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

其他提示

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.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top