Skip to main content

VerticalGridSettings.CustomUnboundRowData Property

Allows you to supply data to unbound rows.

Namespace: DevExpress.Web.Mvc

Assembly: DevExpress.Web.Mvc5.v24.1.dll

NuGet Package: DevExpress.Web.Mvc5

Declaration

public ASPxVerticalGridRowDataEventHandler CustomUnboundRowData { get; set; }

Property Value

Type Description
ASPxVerticalGridRowDataEventHandler

A ASPxVerticalGridRowDataEventHandler delegate method allowing you to implement custom processing.

Remarks

To provide unbound rows with data using a delegate method, assign this delegate method to the CustomUnboundRowData property. The delegate method assigned to this property will be called for unbound rows only.

The code sample below demonstrates how to add an unbound row that retrieves data using a delegate method.

Partial View code:

@Html.DevExpress().VerticalGrid(settings => {
    settings.Name = "VerticalGrid";
    settings.CallbackRouteValues = new { Controller = "Home", Action = "VerticalGridPartial" };
    // ...
    // Add rows bound to model fields.
    settings.Rows.Add("FirstName");
    settings.Rows.Add("LastName");
    settings.Rows.Add(row => {
        // "FieldName" contains a unique value that does not refer to any field in the VerticalGrid's data model. 
        row.FieldName = "FullName";
        // The row contains string values.
        row.UnboundType = DevExpress.Data.UnboundColumnType.String;
    });
    // A delegate method that allows you to generate data for an unbound row.
    settings.CustomUnboundRowData = (s, e) => {
        if (e.Row.FieldName == "FullName") {
            string firstName = (e.GetListSourceFieldValue("FirstName")).ToString();
            string lastName = (e.GetListSourceFieldValue("LastName")).ToString();
            e.Value = firstName + " " + lastName;
        };
    };
}).Bind(Model).GetHtml()

Note

When the VerticalGrid extension is bound to a data source in Database Server Mode, you can only enable sorting, filtering and summary calculation for unbound columns that are populated with unbound expressions.

See Also