Skip to main content
Tab

ASPxGridView.CollapseRow(Int32) Method

Collapses the specified group row.

Namespace: DevExpress.Web

Assembly: DevExpress.Web.v23.2.dll

NuGet Package: DevExpress.Web

Declaration

public void CollapseRow(
    int visibleIndex
)

Parameters

Name Type Description
visibleIndex Int32

The row’s visible index.

Remarks

When you call the server-side ExpandRow(Int32) or CollapseRow(Int32) method, the grid behaves as follows:

  • Expands or collapses the specified group row.
  • Preserves the current expanded or collapsed state of child group rows at all nesting levels of the specified group row.

To expand or collapse all group rows in the grid on the server side, call the ExpandAll() or CollapseAll() method.

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

<dx:ASPxGridView ID="ASPxGridView1" runat="server" ClientInstanceName="grid"
    OnCustomCallback="ASPxGridView1_CustomCallback">
    <%--...--%>
    <Settings ShowGroupPanel="true" />
</dx:ASPxGridView>
<dx:ASPxButton ID="ASPxButton1" runat="server" Text="Expand/Collapse the First Row" AutoPostBack="false">
    <ClientSideEvents Click="OnClick" />
</dx:ASPxButton>
function OnClick(s, e) {
    grid.PerformCallback();
}
protected void ASPxGridView1_CustomCallback(object sender, ASPxGridViewCustomCallbackEventArgs e) {
    if(ASPxGridView1.IsRowExpanded(0))
        ASPxGridView1.CollapseRow(0);
    else
        ASPxGridView1.ExpandRow(0);
}
See Also