Dot Net Tips and Tricks

Custom Search

Archive for the 'Infragistics' Category

UltraWinGrid and bound DataSource

I found a nice trick for the Infragistic’s UltraWinGrid. The UltraGridRow has a property ListObject which can be cast to the original datasource object.  An example would be the following:

IList<CustObjectBE> orders = new List<CustObjectBE>();

UltraWinGrid grid = gridOrders; <– Grid on a form.

grid.DataSource = orders;

UltraGridRow row = grid.ActiveRow;

CustObjectBE order = row.ListObject as CustObjectBE;

if (order != null)

{

//Do something here.

}

This method provides a convenient way to get the bound object to a row in the grid.

No comments