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

expand / collapse programmatically

1 Answer 378 Views
GridView
This is a migrated thread and some comments may be shown as answers.
joseph_korn
Top achievements
Rank 1
joseph_korn asked on 13 May 2008, 10:43 PM
I am trying to find a method that will allow me to programmatically expand all or collapse all detail lines in a RadWinGrid.. I really only need them to be expanded at the point when the gridview is populated.. I have tried using Me.gridview1.MasterGridViewTemplate.AutoExpandGroups = True with no success.. I believe this is because I am using a ChildGridViewTemplate for the detail line, and then linking it to the parent row via a GridViewRelation as opposed to using groups..

Any help would be appreciated!

1 Answer, 1 is accepted

Sort by
0
Accepted
Jack
Telerik team
answered on 14 May 2008, 03:03 PM
Hi Joseph,

Thank you for contacting us.

As you have noticed, the AutoExpandGroups property works for groups only. If you have groups in the child views, you should set to true the AutoExpandGroups property of the coresponding GridViewTemplate. Consider the sample code snippet below:

Me.gridview1.MasterGridViewTemplate.ChildGridViewTemplates(0).AutoExpandGroups = True 
 
 

In case of many rows expanding/collapsing all of them will be time and memory consuming task. Because of this RadGridView doesn't contain a property or a method executing this task. You can work around this by using the following code:

Me.radGridView1.GridElement.BeginUpdate() 
For Each row As GridViewDataRowInfo In Me.radGridView1.Rows 
    row.IsExpanded = True 
Next 
Me.radGridView1.GridElement.EndUpdate() 

I suggest you to use groups instead of child views when possible. We will try to optimize grid's performance in such scenario for our future versions.

  
Best wishes,
Jack
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
Tags
GridView
Asked by
joseph_korn
Top achievements
Rank 1
Answers by
Jack
Telerik team
Share this question
or