4 Answers, 1 is accepted
0
Hello Jürgen,
I am not completely sure whether you want to expand/collapse hierarchy grid or a grid groups. If you want to expand/collapse hierarchy items you could hook OnPreRender event handler and loop through all items and set their Expanded property to true/false. Check out the following code snippet.
If you want to expand/collapse grid groups you could use the same approach but instead looping through the RadGrid items you should loop through the GridGroupHeaderItem collection.
Greetings,
Kostadin
the Telerik team
I am not completely sure whether you want to expand/collapse hierarchy grid or a grid groups. If you want to expand/collapse hierarchy items you could hook OnPreRender event handler and loop through all items and set their Expanded property to true/false. Check out the following code snippet.
protected
void
gridView_PreRender(
object
sender, EventArgs e)
{
if
(!Page.IsPostBack)
{
foreach
(GridDataItem item
in
RadGrid1.MasterTableView.Items)
{
item.Expanded =
true
;
}
}
}
If you want to expand/collapse grid groups you could use the same approach but instead looping through the RadGrid items you should loop through the GridGroupHeaderItem collection.
protected
void
RadGrid1_PreRender(
object
sender, EventArgs e)
{
if
(Page.IsPostBack)
{
foreach
(GridGroupHeaderItem item
in
RadGrid1.MasterTableView.GetItems(GridItemType.GroupHeader))
{
if
(
int
.Parse(item.GroupIndex) % 2 == 0)
{
item.Expanded =
false
;
}
}
}
}
Greetings,
Kostadin
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
0
Jürgen
Top achievements
Rank 1
answered on 16 Apr 2013, 11:32 AM
Hello Kostadin,
Thanks, it's working as expected.
Thanks, it's working as expected.
0
Roman
Top achievements
Rank 1
answered on 15 Jul 2013, 07:36 AM
Hi,
This is not working for RadPivotGrid because RadPivotGrid do not have MasterTableView definition. Pasted code works for RadGrid, but not for RadPivotGrid. Is this possible for RadPivotGrid?
This is not working for RadPivotGrid because RadPivotGrid do not have MasterTableView definition. Pasted code works for RadGrid, but not for RadPivotGrid. Is this possible for RadPivotGrid?
0
Hello Roman,
Please review the following live example where only one of the column groups is expanded.
Regards,
Kostadin
Telerik
Please review the following live example where only one of the column groups is expanded.
Regards,
Kostadin
Telerik
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to the blog feed now.