Edit this page

Expanding all rows

In order to expand all rows in RadGridView you have to iterate through them and set the IsExpanded property to true. The following code snippet demonstrates how to achieve it. You can call the method when the grid is loaded or when you click a button :

void ExpandAllRows(GridViewTemplate template, bool expanded)
    foreach (GridViewRowInfo row in template.Rows)
        row.IsExpanded = expanded;
    if (template.Templates.Count > 0)
        foreach (GridViewTemplate childTemplate in template.Templates)
            ExpandAllRows(childTemplate, true);

Private Sub ExpandAllRows(ByVal template As GridViewTemplate, ByVal expanded As Boolean)
    For Each row As GridViewRowInfo In template.Rows
        row.IsExpanded = expanded
    If template.Templates.Count > 0 Then
        For Each childTemplate As GridViewTemplate In template.Templates
            ExpandAllRows(childTemplate, True)
    End If
End Sub

See Also

Is this article helpful? Yes / No
Thank you for your feedback!

Give article feedback

Tell us how we can improve this article