Tab

ASPxVerticalGrid Class

A vertical grid control.

Namespace: DevExpress.Web

Assembly: DevExpress.Web.v20.2.dll

Declaration

public class ASPxVerticalGrid :
    ASPxGridBase

The following members accept/return ASPxVerticalGrid objects:

Remarks

The ASPxVerticalGrid is a data bound control that displays data source fields as columns and records as rows in a table.

DevExpress ASP.NET Vertical Grid

Run Demo: Vertical Grid Demos

Create a Vertical Grid

Design Time

The ASPxVerticalGrid control is available on the DX.20.2: Data & Analytics toolbox tab in the Microsoft Visual Studio IDE.

Drag the control onto a form and customize the control's settings, or paste the control markup in the page's source code.

NOTE

To properly function, DevExpress controls require that special modules, handlers and options are registered in the the Web.config file. Switch the Microsoft Visual Studio IDE to the Design tab to automatically update the Web.config file with the required DevExpress information.

<dx:ASPxVerticalGrid ID="ASPxVerticalGrid1" runat="server" DataSourceID="SqlDataSource1" 
    KeyFieldName="SupplierID" Width="70%" >
    <Rows>
        <dx:VerticalGridCategoryRow Caption="Contact Information">
            <Rows>
                <dx:VerticalGridTextRow FieldName="CompanyName" VisibleIndex="1" />
                <dx:VerticalGridTextRow FieldName="ContactName" VisibleIndex="2" />
            </Rows>
        </dx:VerticalGridCategoryRow>
        <dx:VerticalGridCategoryRow Caption="Address Information">
            <Rows>
                <dx:VerticalGridTextRow FieldName="Country" VisibleIndex="3" />
                <dx:VerticalGridTextRow FieldName="City" VisibleIndex="4" />
                <dx:VerticalGridTextRow FieldName="Address" VisibleIndex="5" />
            </Rows>
        </dx:VerticalGridCategoryRow>
    </Rows>
    <SettingsPager Mode="ShowPager" PageSize="3"></SettingsPager>
</dx:ASPxVerticalGrid>

<asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="Provider=Microsoft.Jet.OLEDB.4.0;
  Data Source=|DataDirectory|\nwind.mdb;Persist Security Info=True" ProviderName="System.Data.OleDb" 
  SelectCommand="SELECT [SupplierID], [ContactName], [Country], [City], [Address], [CompanyName] FROM [Suppliers]">
</asp:SqlDataSource>

Run Time

<asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="Provider=Microsoft.Jet.OLEDB.4.0;
  Data Source=|DataDirectory|\nwind.mdb;Persist Security Info=True" ProviderName="System.Data.OleDb" 
  SelectCommand="SELECT [SupplierID], [ContactName], [Country], [City], [Address], [CompanyName] FROM [Suppliers]">
</asp:SqlDataSource>
using DevExpress.Web;
using DevExpress.Data;
...
protected void Page_Load(object sender, EventArgs e)  {
    ASPxVerticalGrid verticalGrid1 = new ASPxVerticalGrid();
    verticalGrid1.ID = "VerticalGrid1";
    Page.Form.Controls.Add(verticalGrid1);
    verticalGrid1.AutoGenerateRows = false;
    verticalGrid1.DataSourceID = "SqlDataSource1";
    verticalGrid1.KeyFieldName = "SupplierID";
    verticalGrid1.Width = Unit.Percentage(80);

    VerticalGridCategoryRow category1 = new VerticalGridCategoryRow("Contact Information");

    VerticalGridTextRow row1 = new VerticalGridTextRow();
    row1.FieldName = "CompanyName";
    row1.VisibleIndex = 1;

    VerticalGridTextRow row2 = new VerticalGridTextRow();
    row2.FieldName = "ContactName";
    row2.VisibleIndex = 2;

    category1.Rows.Add(row1);
    category1.Rows.Add(row2);

    VerticalGridCategoryRow category2 = new VerticalGridCategoryRow("Address Information");

    VerticalGridTextRow row3 = new VerticalGridTextRow();
    row3.FieldName = "Country";
    row3.VisibleIndex = 3;

    VerticalGridTextRow row4 = new VerticalGridTextRow();
    row4.FieldName = "City";
    row4.VisibleIndex = 4;

    VerticalGridTextRow row5 = new VerticalGridTextRow();
    row5.FieldName = "Address";
    row5.VisibleIndex = 5;

    category2.Rows.Add(row3);
    category2.Rows.Add(row4);
    category2.Rows.Add(row5);

    verticalGrid1.Rows.Add(category1);
    verticalGrid1.Rows.Add(category2);

    verticalGrid1.SettingsPager.Mode = VerticalGridPagerMode.ShowPager;
    verticalGrid1.SettingsPager.PageSize = 3;
}

KB Article: How to create controls dynamically

Client-Side API

Availability

Available by default.

Client object type

ASPxClientVerticalGrid

Access name

ASPxVerticalGrid.ClientInstanceName

Events

ASPxVerticalGrid.ClientSideEvents

Data Binding

The ASPxVerticalGrid works only in bound mode. You can bind the vertical grid to any standard data source type: SqlDataSource, ObjectDataSource, XmlDataSource, AccessDataSource, and SiteMapDataSource.

Use the ASPxVerticalGrid.KeyFieldName property to set a data source's key field name. The ASPxVerticalGrid.DataSourceID and ASPxVerticalGrid.DataSource properties specify the data source's ID and the data source object, respectively.

ASPxVerticalGrid.DataSourceID:

<dx:ASPxVerticalGrid ID="ASPxVerticalGrid1" runat="server" DataSourceID="SqlDataSource1" 
    KeyFieldName="SupplierID" Width="70%" >
    <Rows>
        <dx:VerticalGridCategoryRow Caption="Contact Information">
            <Rows>
                <dx:VerticalGridTextRow FieldName="CompanyName" VisibleIndex="1" />
                <dx:VerticalGridTextRow FieldName="ContactName" VisibleIndex="2" />
            </Rows>
        </dx:VerticalGridCategoryRow>
        <dx:VerticalGridCategoryRow Caption="Address Information">
            <Rows>
                <dx:VerticalGridTextRow FieldName="Country" VisibleIndex="3" />
                <dx:VerticalGridTextRow FieldName="City" VisibleIndex="4" />
                <dx:VerticalGridTextRow FieldName="Address" VisibleIndex=&quo