I am trying to find a way to get the UltraGridRow in the UltraWinGrid control that is related to my UltraDataRow in the UltraWinDataSource. So far, I have not been successful. Does anyone know how to do this?
If you know the index of the row in the list, you can use the GetRowWithListIndex method on the grid's Rows collection. This can be tricky, though, as the list here is the BindingList, not the actual list of rows in the UltraDataSource.
Another option would be to loop through the grid rows yourself and examine the ListObject of each row to see if it's the UltraDataRow you want.
Hi,
I got an idea - and I've been using this in my application for a while now. Try assigning a unique object to the Tag property of the DataRow; then if you have a specific GridRow selected, you can just retreive that object from the Row's Tag object and determine if they are the same. This way, there is a 1-to-1 relationship between DataRow and GridRow. The drawback is that you'll have to synchronize lock your datasource when iterating through each row.
kel
hi,
I forgot to mention, you might also try using UltraGrid.ActiveRow.ListObject and UltraGrid.ActiveRow.ListIndex properties.
These two properties will essentially give you the corresponding IList object, the the IList inedex - to which your UltraGridRow is bound to.
br,
This is pretty close to what I actually did to get the gridrow that I needed. What I did was set the tag property of the DataRow to the GridRow. Then, when the CellDataRequested event fired for the data source, I was able to see which grid row the data row was associated with.
I can use this work-around for my implentation but i see this is very old post and wanted to see if there is a better way now.
I am populating UltraDataSource from business objects and i am setting the tag property for UltraDataRow that i am adding to UltraDataSource. However, the tag property is not being set in UltraGridRow collection.I am checking it in InitializeRow event of UltraGrid and see that the Tag is null. How do i find the corresponding ultradatasource row for the grid row?