Hello,
I have a RadGrid with three groups. I would like to always have one and only one group expanded at a time. I have successfully configured the grid to have the first group by doing this in the ItemDataBound event:
I tried this code to handle expanding only the "clicked on" header item, but it does not work:
Even though I'm setting the .Expanded attribute to True (I observe that one item gets hit during debugging), all groups end up collapsed.
I know I can use GroupLoadMode="Client" and try to handle things in Javascript, but I'm not really sure where to begin with that. I guess I'd prefer to not round-trip to the server, but I'll take any code that works at this point.
Thank you!
I have a RadGrid with three groups. I would like to always have one and only one group expanded at a time. I have successfully configured the grid to have the first group by doing this in the ItemDataBound event:
If
TypeOf
e.Item
Is
GridGroupHeaderItem
Then
Dim
item
As
GridGroupHeaderItem = e.Item
If
item.GroupIndex =
"0"
Then
item.Expanded =
True
End
If
End
If
I tried this code to handle expanding only the "clicked on" header item, but it does not work:
Private
Sub
rgvReportGrid_ItemCommand(
ByVal
source
As
Object
,
ByVal
e
As
Telerik.Web.UI.GridCommandEventArgs)
Handles
rgvReportGrid.ItemCommand
If
e.CommandName = RadGrid.ExpandCollapseCommandName
Then
Dim
item
As
GridGroupHeaderItem = e.Item
Dim
groupIndex
As
String
= item.GroupIndex.ToString
Dim
grid
As
RadGrid = source
For
Each
gridItem
As
GridItem
In
grid.MasterTableView.Controls(0).Controls
If
TypeOf
(gridItem)
Is
GridGroupHeaderItem
Then
Dim
groupHeaderItem
As
GridGroupHeaderItem = gridItem
If
groupHeaderItem.GroupIndex.ToString = groupIndex
Then
groupHeaderItem.Expanded =
True
Else
groupHeaderItem.Expanded =
False
End
If
End
If
Next
End
If
End
Sub
Even though I'm setting the .Expanded attribute to True (I observe that one item gets hit during debugging), all groups end up collapsed.
I know I can use GroupLoadMode="Client" and try to handle things in Javascript, but I'm not really sure where to begin with that. I guess I'd prefer to not round-trip to the server, but I'll take any code that works at this point.
Thank you!