RadGrid for ASP .NET version
RadControls for ASP .NET AJAX version |
4.6.2 and later
2008.1.415 and later
|
.NET version |
2.0 and later
|
Visual Studio version |
2005 and later
|
Programming language |
C#, VB.NET
|
Browser support |
all supported by RadGrid for ASP .NET
all browsers supported by RadControls for ASP .NET AJAX
|
PROJECT DESCRIPTION
This demo illustrates how to hide the grouped column in RadGrid and then show it again when ungroup action is progressed. The solution is pretty straight-forward:
- intercept the GroupsChanging event
- check the action which is about to be executed (group or ungroup)
- designate the column in progress using the group expression's GroupByFields collection
- switch the visibility of that column
Protected Sub RadGrid1_GroupsChanging(ByVal source As Object, ByVal e As Telerik.WebControls.GridGroupsChangingEventArgs) Handles RadGrid1.GroupsChanging |
If (e.Action = GridGroupsChangingAction.Group) Then |
RadGrid1.MasterTableView.GetColumnSafe(e.Expression.GroupByFields(0).FieldName).Visible = False |
ElseIf (e.Action = GridGroupsChangingAction.Ungroup) Then |
RadGrid1.MasterTableView.GetColumnSafe(e.Expression.GroupByFields(0).FieldName).Visible = True |
End If |
End Sub |