Tab

ASPxVerticalGrid.GetRecordValues(Int32, String[]) Method

Returns the values of the specified data source fields within the specified record.

Namespace: DevExpress.Web

Assembly: DevExpress.Web.v20.2.dll

Declaration

public object GetRecordValues(
    int visibleIndex,
    params string[] fieldNames
)
Public Function GetRecordValues(
    visibleIndex As Integer,
    ParamArray fieldNames As String()
) As Object

Parameters

Name Type Description
visibleIndex Int32

An integer value that identifies the record.

fieldNames String[]

The names of data source fields whose values within the specified record are returned.

Returns

Type Description
Object

An object which is an array of field values (if several field names are passed via the fieldNames parameter) or a direct field value (if a single field name is passed via the fieldNames parameter).

Remarks

The GetRecordValues method returns the values of the specified data source fields in the specified grid data row.

To work correctly, the GetRecordValues method needs the grid to be bound to its data source. If the grid isn't bound yet, the GetRecordValues method automatically performs implicit data binding of the grid.

Example

Web Forms approach:

protected void ASPxVerticalGridView1_CommandButtonInitialize(object sender, ASPxVerticalGridCommandButtonEventArgs e)
{
    ASPxVerticalGrid verticalGrid = sender as ASPxVerticalGrid;
    int totalValue = Convert.ToInt32(verticalGrid.GetRecordValues(e.VisibleIndex, "Total"));
    if (e.ButtonType == VerticalGridCommandButtonType.SelectCheckbox)
    {
        if (totalValue > 15000)
            verticalGrid.Selection.SelectRecord(e.VisibleIndex);
    }
}

MVC approach:

settings.CommandButtonInitialize = (sender, e) =>
{
    ASPxVerticalGrid verticalGrid = sender as ASPxVerticalGrid;
    int totalValue = Convert.ToInt32(verticalGrid.GetRecordValues(e.VisibleIndex, "Total"));
    if (e.ButtonType == VerticalGridCommandButtonType.SelectCheckbox)
    {
        if (totalValue > 15000)
            verticalGrid.Selection.SelectRecord(e.VisibleIndex);
    }    
};
See Also