UltraWinGrid: Row.Index property

Posts   
 
    
caseyry
User
Posts: 79
Joined: 25-Feb-2005
# Posted on: 03-Aug-2006 16:28:52   

I'm using Fran's favorite win control, UltraWinGrid v 2005.2 and LLBLGen 1.2005.1 with self servicing.

The UltraWinGrid is bound to an entity collection and when I click on a row in the grid, I'd like to get that row's entity.

What I've been doing is something like this:



collection = this.ultraGrid.DataSource as collection;

if ((collection != null) && (collection .Count >= e.Cell.Row.Index) )
{
    entity = collection [e.Cell.Row.Index];
}
else
    return;

// proceed with entity manipulation


The problem with this is that the UltraWinGrid is sorted and so the Grid.Row.Index property is returning the index of the selected row in the grid (say 1) but, that Index property doesn't match the collection's index; i.e. collection[Row.index] returns the wrong entity.

I don't think the bug is with the LLBLGen collection code, but rather Infragistics is not returning the index of the row in the "parent collection" as the summary for the Row.Index property states.

I'm going to contact Infragistics as well to see what they recommend for getting the current row's underlying data source, but have you all had this problem and do you know of a work around?

Thanks.

caseyry
User
Posts: 79
Joined: 25-Feb-2005
# Posted on: 03-Aug-2006 16:36:15   

caseyry wrote:

I'm going to contact Infragistics as well to see what they recommend for getting the current row's underlying data source, but have you all had this problem and do you know of a work around?

Oops...Right after posting this I dug through the UltraGridRow properties and saw:


Row.ListObject

Which the documentation for states: "returns the object corresponding to this row from the IList that the control is bound to. Returns Null if this is an UltraGridGroupByRow. "

Sorry for the noise.

Thanks.