Hide expand/collapse image in hierarchical RadGridView
Product Version | Product | Author | Last modified |
---|---|---|---|
Q2 2010 SP1 | RadGridView for WinForms | Nikolay Diyanov | July 27, 2010 |
PROBLEM
When RadGridView displays hierarchical data, you expand/collapse child levels in the hierarchy with the help of GridGroupExpanderCellElement containing an expand/collapse image. However, when you do not have child data for certain rows, you may not want to show the expand/collapse images in the GridGroupExpanderCellElement.
SOLUTION
First of all, we will create a method which returns true if there is child data and false if there is no child data for a parent row:
Next, we will subscribe to the ViewCellFormatting and ChildViewExpanding events of RadGridView. In ViewCellFormatting we will hide the expand/collapse image while in the ChildViewExpanding we will prevent a row from being expanded if there is no child data: