Back to Devexpress

ASPxGridView.CollapseAll() Method

aspnet-devexpress-dot-web-dot-aspxgridview-ceb606d0.md

latest2.8 KB
Original Source

ASPxGridView.CollapseAll() Method

Collapses all group rows.

Namespace : DevExpress.Web

Assembly : DevExpress.Web.v25.2.dll

NuGet Package : DevExpress.Web

Declaration

csharp
public void CollapseAll()
vb
Public Sub CollapseAll

Remarks

Call the server-side ExpandAll() or CollapseAll method to expand or collapse all group rows in the grid.

To expand or collapse a particular group row on the server side, call the ExpandRow or CollapseRow method.

For more information on grouping in the grid, refer to the following topic: ASPxGridView - Group Data.

aspx
<dx:ASPxGridView ID="ASPxGridView1" runat="server" ClientInstanceName="grid"
    OnCustomCallback="ASPxGridView1_CustomCallback">
    <%--...--%>
    <Settings ShowGroupPanel="true" />
</dx:ASPxGridView>


<dx:ASPxButton ID="ASPxButton1" runat="server" Text="Expand All" AutoPostBack="false">
    <ClientSideEvents Click="ExpandRows" /> 
</dx:ASPxButton>
<dx:ASPxButton ID="ASPxButton2" runat="server" Text="Collapse All" AutoPostBack="false">
    <ClientSideEvents Click="CollapseRows" /> 
</dx:ASPxButton>
js
function ExpandRows(s, e) {
    grid.PerformCallback("expand");
}

function CollapseRows(s, e) {
    grid.PerformCallback("collapse");
}
csharp
protected void ASPxGridView1_CustomCallback(object sender, ASPxGridViewCustomCallbackEventArgs e) {
    if(e.Parameters == "expand") {
        ASPxGridView1.ExpandAll();
    } else if(e.Parameters == "collapse") {
        ASPxGridView1.CollapseAll();
    }
}
vb
Protected Sub ASPxGridView1_CustomCallback(ByVal sender As Object, ByVal e As ASPxGridViewCustomCallbackEventArgs)
    If e.Parameters = "expand" Then
        ASPxGridView1.ExpandAll()
    ElseIf e.Parameters = "collapse" Then
        ASPxGridView1.CollapseAll()
    End If
End Sub

See Also

ASPxGridView Class

ASPxGridView Members

DevExpress.Web Namespace