ExtensionsFactory.VerticalGrid<ColumnType>(Action<VerticalGridSettings<ColumnType>>) Method
Creates a VerticalGrid.
Namespace: DevExpress.Web.Mvc.UI
Assembly: DevExpress.Web.Mvc5.v24.1.dll
NuGet Package: DevExpress.Web.Mvc5
Declaration
public VerticalGridExtension<ColumnType> VerticalGrid<ColumnType>(
Action<VerticalGridSettings<ColumnType>> method
)
where ColumnType : class
Parameters
Name | Type | Description |
---|---|---|
method | Action<VerticalGridSettings<ColumnType>> | A delegate method that accepts VerticalGridSettings<ColumnType> as a parameter. |
Type Parameters
Name |
---|
ColumnType |
Returns
Type | Description |
---|---|
VerticalGridExtension<ColumnType> | A VerticalGridExtension<ColumnType> object implementing the VerticalGrid functionality. |
Remarks
To enable binding grid rows to Model fields using lambdas, it is required to declare the VerticalGrid extension using the VerticalGrid<ColumnType> strongly-typed declaration method.
Note
The partial View with the VerticalGrid extension does not need to be strongly-typed.
The code example below demonstrates how to declare the strongly-typed VerticalGrid with rows bound to data model fields via lambda expressions.
@(
// Grid displays instances of the Customer class.
Html.DevExpress().VerticalGrid<Customer>(settings => {
settings.Name = "VerticalGrid";
settings.CallbackRouteValues = new { Controller = "Home", Action = "VerticalGridPartial" };
settings.KeyFields(m => m.CustomerID);
// The following rows are bound to Model fields via lambdas.
settings.Rows.Add(m => m.ContactName, row => {
row.SortIndex = 0;
row.SortOrder = DevExpress.Data.ColumnSortOrder.Ascending;
});
settings.Rows.Add(m => m.CompanyName);
settings.Rows.Add(m => m.Country);
settings.Rows.Add(m => m.City);
settings.Rows.Add(m => m.Region);
}).Bind(Model).GetHtml()
)