Collapse all the Groups in a Telerik ASP.NET RadGrid

When a RadGrid loads with grouped data, it often shows too much detail by default. If you want a cleaner first impression, you can collapse all groups on initial load with one simple event.

The solution is to add a RadGrid_PreRender event (it fires after NeedDataSource) to loop through the grid and collapse. 

Protected Sub RadGrid1_PreRender(sender As Object, e As EventArgs) Handles RadGrid1.PreRender
    If Not Page.IsPostBack Then
        For Each item As GridGroupHeaderItem In RadGrid1.MasterTableView.GetItems(GridItemType.GroupHeader)
            item.Expanded = False
        Next
    End If
End Sub

That’s all you need — a clean, collapsed RadGrid on first load without any client-side hacks.

 

 


RealWorldCode gives developers practical, real‑world solutions with clean, working code — no fluff, no theory, just answers.
Links
Home
Knowledge Areas
Sitemap
Contact
Et cetera
Privacy Policy
Terms and Conditions
Cookie Preferences