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

DBG/Hierarchical Add col, Button

Could you please show me how to add a button to a lower level (unbound) in a DBG/hier.? The example does it to a first level, which works OK, but I can not untie the calls to get it into lower levels, unbound, added column. Thank you.

3 Replies

Administrator August 4, 2004 02:01 PM UTC

In your QueryCellInfo where you are providing the value for the unbound column, instead of just checking e.ColIndex, use code like this to get the GridBoundRecordState for the given row. GridBoundRecordState rs = this.grid.Binder.GetRecordStateAtRowIndex(e.RowIndex); Once you have this object, you can check rs.LevelIndex to see what hierarchy level you are on, and then you can set the properties in e.Style accordingly for a particular level.

EA Earl August 4, 2004 02:16 PM UTC

I''m using your 3967-1 example code & ExpandGrid. Does "gridDataBoundGrid1.Model.ColWidths[x]" act on the lower level items?

Administrator August 4, 2004 03:19 PM UTC

Yes, it should work unless there is something else preventing teh sizing from working. In a GridDataBoundGrid hierarchical grid, there really is only one grid, so properties like colwidth affect all levels. One thing that might prevent this from working initially is if you do not set grid.AllowResizeToFit = false. If this is true, the grid tries to autosize things initially, and this can step only any explicit sizing you try to do.
Live Chat Icon For mobile
Up arrow icon