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
close icon

Hierarchical Grid Row to DataTable Row Mapping

I have a grid with three levels of hierarchy based on three datatables in a single dataset. In order to handle one of the grid events I am trying to determine which row in a datatable grid row maps to by using Binder.RowIndexToListManagerPosition which works great for the root level but does not work/exist for other levels. Any ideas on how to determine datatable row position for the second and third level? Thanks, Adi

4 Replies

AD Administrator Syncfusion Team November 18, 2003 05:36 AM UTC

It is not easy to get the actual row position in the orginal table, but you can get the actual row object in the datatable with code like: GridBoundRecordState rs = this.gridDataBoundGrid1.Binder.GetRecordStateAtRowIndex(gridRowIndex); int pos = rs.Position; CurrencyManager cm = (CurrencyManager) rs.ListManager; DataRow dr = ((DataRowView)cm.List[pos]).Row; Hopefully, you only need the actual object to do your work, and not its positin in the original table. If you need the to know the index in the original table, you would have to loop through the tables.Rows looking for the above dr. Using our GridGroupingControl (available in teh upcoming 2.0 release), you will be able to map any row back to the original position.


AD Adi November 19, 2003 04:43 PM UTC

Thanks Clay, this helps. I have another follow-up question: my hierarchical grid has three levels. The far right column in each level is a checkbox control. Do you know if there is an easy way to show using tristate (grey checkbox) if one of the child records has been checked but also not allow user to select indeterminate checkbox state? I know this might be hard to imagine so please do let me know if I can clarify. Thanks


AD Administrator Syncfusion Team November 19, 2003 05:54 PM UTC

If I am understanding what you want, I think it would be difficult. The main reason is that there is no simple way to get at child records unless the node is opened. So, if you want you parent checkbox to reflect the state of its child record when the node is closed, then you would have to go to some trouble to do it, getting everything from the ADO.NET structures (without using any grid information to do so). This will be simpler to do in the upcoming 2.0 release with its grouping support.


AD Adi November 19, 2003 06:57 PM UTC

That is what I thought. Thanks Clay.

Loader.
Live Chat Icon For mobile
Up arrow icon