Skip to main content
All docs
V24.1
.NET 6.0+
  • The page you are viewing does not exist in the .NET Framework 4.5.2+ platform documentation. This link will take you to the parent topic of the current section.

DevExpress v24.1 Update — Your Feedback Matters

Our What's New in v24.1 webpage includes product-specific surveys. Your response to our survey questions will help us measure product satisfaction for features released in this major update and help us refine our plans for our next major release.

Take the survey Not interested

DxGridListEditor.GridInstance Property

Provides access to methods of the DxGrid control.

Namespace: DevExpress.ExpressApp.Blazor.Editors

Assembly: DevExpress.ExpressApp.Blazor.v24.1.dll

NuGet Package: DevExpress.ExpressApp.Blazor

#Declaration

public IGrid GridInstance { get; }

#Property Value

Type Description
IGrid

An IGrid object.

#Remarks

Use the GridInstance property to call methods of the grid control. To change grid properties, use GridModel.

The DxGrid instance becomes available after it is rendered. Always check that GridInstance is not null.

using DevExpress.ExpressApp;
using DevExpress.ExpressApp.Actions;
using DevExpress.ExpressApp.Blazor.Editors;

namespace MySolution.Blazor.Server.Controllers;

public class TestController : ViewController<ListView> {
    public TestController() {
        SimpleAction simpleAction = new SimpleAction(this, "Test Action", DevExpress.Persistent.Base.PredefinedCategory.Edit);
        simpleAction.Execute += (s, e) => {
            if(View.Editor is DxGridListEditor editor) {
                // Always check that GridInstance is not `null`.
                editor.GridInstance?.CollapseAllGroupRows();
            }
        };
    }
}

The code sample below demonstrates how to access DxGrid API using the GridComponentCaptured event.

using DevExpress.ExpressApp;
using DevExpress.ExpressApp.Blazor.Editors;

namespace MySolution.Blazor.Server.Controllers;

public class TestController : ViewController<ListView> {
    protected override void OnViewControlsCreated() {
        base.OnViewControlsCreated();
        if(View.Editor is DxGridListEditor editor) {
            editor.GridComponentCaptured += (s, e) => {
                e.Grid.CollapseAllGroupRows();
            };
        }
    }
}

Note

Do not cache the grid instance in controller fields because the grid can be disposed of and then rendered again when a user navigates the XAF application. Handle the GridComponentCaptured event every time you access the grid instance.

See Also