This is a migrated thread and some comments may be shown as answers.

GridViewGroupRow

4 Answers 151 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Scott Michetti
Top achievements
Rank 1
Iron
Scott Michetti asked on 16 Sep 2015, 02:47 PM

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

Sort by
0
Ivan Ivanov
Telerik team
answered on 16 Sep 2015, 04:53 PM
Hello,

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
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
0
Scott Michetti
Top achievements
Rank 1
Iron
answered on 16 Sep 2015, 05:53 PM

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

0
Ivan Ivanov
Telerik team
answered on 17 Sep 2015, 02:33 PM
Hello,

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
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
0
Scott Michetti
Top achievements
Rank 1
Iron
answered on 17 Sep 2015, 04:48 PM

Thanks Ivan,

That's a great idea.

 

Scott

Tags
GridView
Asked by
Scott Michetti
Top achievements
Rank 1
Iron
Answers by
Ivan Ivanov
Telerik team
Scott Michetti
Top achievements
Rank 1
Iron
Share this question
or