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

Hierarchy Grid

I''m using a Grid data bound grid and gridhierarchylevel for displaying a Master-Detail. I want to access the row index of the current/selected row in the detail table. What method or properties should I be using to do this. I tried to use CurrencyManager but the datasource for the Grid is the Master table. I''ve looked at the sample for GridHierarchyLevel and didn''t see any clues. I''m using 1.6.1.8 Thanks Ben

4 Replies

AD Administrator Syncfusion Team April 14, 2004 08:39 PM UTC

You can get the GridBoundRecordState for the row. int rowIndex = grid.CurrentCell.RowIndex; GridBoundRecordState rs = grid.Binder.GetRecordStateAtRowIndex(rowIndex); rs.Position will have the position of this record in its table.


BE Ben April 20, 2004 01:54 PM UTC

> rs.Position will have the position of this record in its table. I don''t believe that is correct, it was not my experience in practice unless I misunderstood or had a different expectation. rs.Position returns the position value for the record relative to it''s siblings, and is zero based. So it might be position 0, the first child of the parent even though there are other parents with children. To obtain the current record use rs.ListManager.Current. On another note, I have realized I was mistaken in my assumption of how GridHierarchyLevel behaved. If I''m in a GridDataBoundGrid with Master-Detail implemented how can I determine if the current row is a Master or Detail row. Thanks for the support. Ben Andrews


AD Administrator Syncfusion Team April 20, 2004 05:12 PM UTC

I am not sure what you mean by a Master-Details in a GridDataBoundGrid. Are you adding a parent-child relation to the dataset, and showing this in a hierarchical grid? If so, try int rowIndex = grid.CurrentCell.RowIndex; GridBoundRecordState rs = grid.Binder.GetRecordStateAtRowIndex(rowIndex); rs.LevelIndex will have the hierarchy level of the row.


BE Ben April 20, 2004 05:36 PM UTC

Clay, Sorry about the confusion, yes I''m using Master-Detail as parent-child relation to a dataset. >I am not sure what you mean by a Master-Details in a GridDataBoundGrid. Are you adding a parent-child relation to the dataset, and showing this in a hierarchical grid? > Ok, thanks this works. I thought I accessed the hierarchy level from the GridHierarchyLevel but need to use GridBoundRecordState. The documentation in 1.6.1.8 for GridBoundRecordState isn''t very complete, just hoping that it may have been improved for 2.0 >If so, try > >int rowIndex = grid.CurrentCell.RowIndex; >GridBoundRecordState rs = grid.Binder.GetRecordStateAtRowIndex(rowIndex); > > >rs.LevelIndex will have the hierarchy level of the row.

Loader.
Live Chat Icon For mobile
Up arrow icon