Skip to main content
All docs
.NET Framework 4.5.2+

How to: Access the Grid Component in a List View

  • 3 minutes to read

This article explains how to access properties of a grid component displayed in a List View.

You can use this technique with any List Editor control in ASP.NET Core Blazor, Windows Forms, or ASP.NET Web Forms applications.

Step-by-Step Instructions

  1. In Solution Explorer, navigate to:
    • A platform-specific project in a .NET 6 ASP.NET Core Blazor or Windows Forms application.
    • A platform-specific module project in a .NET Framework ASP.NET Web Forms or Windows Forms application.
  2. Add a View Controller to the Controllers folder.
  3. Inherit the controller from the ObjectViewController<ViewType, ObjectType> class and override the OnViewControlsCreated method as demonstrated in the following code example:

    using DevExpress.ExpressApp;
    using DevExpress.ExpressApp.Blazor.Editors;
    using DevExpress.ExpressApp.Blazor.Editors.Models;
    using YourApplicationName.Module.BusinessObjects;
    namespace YourApplicationName.Blazor.Server.Controllers;
    public class GridViewController : ObjectViewController<ListView, TargetClassName> {
        protected override void OnViewControlsCreated() {
            if (View.Editor is DxGridListEditor gridListEditor) {
                // Obtain the Component Adapter.
                IDxGridAdapter dataGridAdapter = gridListEditor.GetGridAdapter();
                // Access grid property.
                dataGridAdapter.GridModel.PagerVisible = false;
                // Access grid columns.
                // Use column settings to disable the sorting and grouping functionality. 
                foreach (DxGridDataColumnModel columnModel in dataGridAdapter.GridDataColumnModels) {
                    columnModel.AllowSort = false;
                    columnModel.AllowGroup = false;

Platform-Specific Events for Control Customization

In Windows Forms or ASP.NET Web Forms applications, a View Item control or a List Editor control may not be ready for customization immediately after creation. If the technique described in this topic does not have the desired effect, handle platform-specific events listed below.

Windows Forms:

The Control object’s HandleCreated, VisibleChanged, or ParentChanged event.

You can also handle Load or any similar event if the current control type exposes it.

ASP.NET Web Forms:

The Control object’s Load or Init server-side event.

Alternatively, you may need to handle the WebWindow.PagePreRender event. Use the CurrentRequestWindow static property to get the current WebWindow object.

If your application also requires customization on the client side, refer to the following topic for additional information: Client-Side Functionality.

Contact our Support Center if you need help.

See Also