We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

GDBG. How can I get RowIndex for specified DataRow object?

Hi. I have dataset with two related tables. And I have DataRow object from child table. How can I get RowIndex for specified DataRow object?

4 Replies

AD Administrator Syncfusion Team July 27, 2004 01:35 AM

There is no simple way to to this. You will have to get the parent row object somehow, find its rowindex in the grid, and then iterate through its child table to find the row object you are looking for. Alternatively, if the grid is displaying a column from your child table with unique values, and teh grids involved are not terribly large, you could iterate through all the rws in the grid looking for the particular child. Take a look at this whole thread. At the bottom, there is a sample that does this. http://www.syncfusion.com/Support/Forums/message.aspx?MessageID=16782

SI Silenter July 28, 2004 04:29 AM

I use gdbg for displaying realtime data. And when realtime data is received from dataprovider I find correspond row in my dataset, then change that row and then refresh gdbg. But I don''t want to refresh entire grid. I want to refresh only corresponding rows. are there any ways to implement it? Regards, Slava.

AD Administrator Syncfusion Team July 28, 2004 05:29 AM

I think you will have to dynamically subscribe and unsubscribe to the child table''s ListChanged event for each parent node in RowExpanding and RowCollapsing. Then you can maintain a hastable of these child tables and the location of their parentrows. Then in the ListChanged handler, you can retrieve the parent row and use the e.NewIndex to determine the grid row that needs refreshing. (Note that when a parent row collapses, you may have to adjust the row values in the hashtable.) Here is a minimal sample that seems to be working ok. As you press the button on the form, a different child row is modified, and only that child row is refreshed. UpdateChild_7608.zip

SI Silenter July 28, 2004 07:49 AM

Yes. Thanks. Now it is realy good performance.

Live Chat Icon For mobile
Up arrow icon