Hello,
How do I get the GridViewGroupRow from the grid? There is a post here http://www.telerik.com/forums/radgridview-opening-groups-programmatically that indicates you can do this through the radgridview.Items.Groups, but this returns an IGroup, which does not have the IsExapnded property that GridViewGroupRow object has.
I would like to loop through the groups and expand/collapse groups based on certain criteria, but I don't know how to get the GridViewGroupRow.
Thanks,
Scott
4 Answers, 1 is accepted
Searching for the group rows in the visual tree would be slow and if any additional logic that affects the visual elements is executed, it can mess with the container recycling logic that RadGridView uses. You can use the RadGridView.ExpandGroup(IGroup) method instead. The groups collection can be accessed through RadGridView.Items.Groups.
Regards,
Ivan Ivanov
Telerik
Thanks for the quick reply Ivan.
What I will have to do is get the GridViewGroupRow objects from the GroupRowIsExpandedChanging event and save those items in a dictionary. Then I can compare the keys to the IGroup objects and use the ExpandGroup/CollapseGroup methods.
Thanks,
Scott
You can directly access the group from args.Row.Group in GroupRowIsExpandedChanging's handler. Thus you will be able to directly store the groups and use them in the Expand/Collapse group methods. I am attaching a simple project that demonstrates the idea.
Regards,
Ivan Ivanov
Telerik
Thanks Ivan,
That's a great idea.
Scott