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

ASPxGridView Class

A server ASPxGridView control.

Namespace: DevExpress.Web

Assembly: DevExpress.Web.v18.1.dll

Declaration

[ToolboxBitmap(typeof(ToolboxBitmapAccess), "Bitmaps256.ASPxGridView.bmp")]
[ToolboxTabName("DX.18.1: Data & Analytics")]
[DXClientDocumentationProviderWeb("ASPxGridView")]
public class ASPxGridView :
    ASPxGridBase,
    ISummaryItemsOwner

Remarks

The ASPxGridView is a data bound control that provides a two-dimensional representation of data from a data source in grid format. Data source fields and records are presented as columns and rows in a table.

ASPxGridView_Class

You can see a list of the main grid features in the Main Features topic.

Columns

The ASPxGridView control stores its columns in the ASPxGridView.Columns collection.

Data columns can be automatically created for each field in the data source when the ASPxGridView is rendered, or created manually, based on the ASPxGridView.AutoGenerateColumns property value. By default, the property is set to true, forcing the ASPxGridView to render each field from the data source as a data column. The order of columns is the same as the order of fields in the data source.

To manually control which columns appear in the ASPxGridView, set the ASPxGridView.AutoGenerateColumns property to false. In this case, you should manually add data columns to the ASPxGridView.Columns collection.

Client-Side API

The ASPxGridView control provides you with comprehensive client-side functionality, implemented using JavaScript code.

The client-side API is always available for this control.

Example

This example demonstrates how to create and initialize an ASPxGridView at runtime.

public partial class _Default : System.Web.UI.Page {
    protected void Page_Load(object sender, EventArgs e) {
        CreateGridView();
    }

    private void CreateGridView() {
        ASPxGridView gv = new ASPxGridView();
        gv.ID = "ASPxGridView1";
        gv.KeyFieldName = "ProductID"; 

        Page.Form.Controls.Add(gv);

        gv.SettingsBehavior.AllowFocusedRow = true;

        gv.DataSource = CreateData();
        gv.DataBind();
    }

    private SqlDataSource CreateData() {
        string conn = "Data Source=(local);
        Initial Catalog=Northwind;Integrated Security=True";
        string selectCmnd = "SELECT [ProductID], [ProductName], 
        [UnitPrice], [UnitsInStock] FROM [Products]";
        return new SqlDataSource(conn, selectCmnd);
    }
}

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

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.

Implements

See Also