Skip to main content
A newer version of this page is available. .
Tab

ASPxGridView.ExpandAll() Method

Expands all group rows.

Namespace: DevExpress.Web

Assembly: DevExpress.Web.v18.2.dll

Declaration

public void ExpandAll()

Remarks

To expand the specified group row, use the ASPxGridView.ExpandRow method. To collapse all group rows, use the ASPxGridView.CollapseAll method.

Example

To expand all the nested detail grids, define a session variable. When the expand action is activated, set it to True, and handle the detail grid's DataBound event. In the event handler check if this variable is set to True, and expand this grid's details using the ASPxGridView.DetailRows.ExpandAllRows method. In the Page.Load event handler, set this variable to False to prevent automatic detail expanding on the next callback or postback.

using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using DevExpress.Web.ASPxGridView;

namespace WebApplication79
{
    public partial class _Default : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            Session["expandAll"] = false;
        }

        protected void ASPxGridView3_BeforePerformDataSelect(object sender, EventArgs e)
        {
            Session["ProductID"] = ((ASPxGridView)sender).GetMasterRowKeyValue();
        }

        protected void ASPxGridView2_BeforePerformDataSelect(object sender, EventArgs e)
        {
            Session["CategoryID"] = ((ASPxGridView)sender).GetMasterRowKeyValue();
        }

        protected void ASPxButton1_Click(object sender, EventArgs e)
        {
            Session["expandAll"] = true;
            ASPxGridView1.DetailRows.ExpandAllRows();
        }

        protected void ASPxGridView2_DataBound(object sender, EventArgs e)
        {
            if (Convert.ToBoolean(Session["expandAll"]))
                ((ASPxGridView)sender).DetailRows.ExpandAllRows();
        }
    }
}

The following code snippets (auto-collected from DevExpress Examples) contain references to the ExpandAll() method.

Note

The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.

See Also