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

ASPxClientGridView.GetSelectedFieldValues(fieldNames, onCallback) Method

Returns the row values displayed within all selected rows.

Declaration

GetSelectedFieldValues(
    fieldNames: string,
    onCallback: ASPxClientGridViewValuesCallback
): void

Parameters

Name Type Description
fieldNames string

The names of data source fields separated via a semicolon, whose values within the selected rows are returned.

onCallback ASPxClientGridViewValuesCallback

A ASPxClientGridViewValuesCallback object that represents the JavaScript function which receives the list of row values as a parameter.

Remarks

The GetSelectedFieldValues method sends a callback to the server to obtain the required field values and passes them back to the client. These values are received by the JavaScript function specified by the onCallback parameter.

Note

  • The GetSelectedFieldValues property is not in effect if cell merging is enabled.
  • The GetSelectedFieldValues method returns column values only. So, if a grid is bound to a collection of complex objects (for example, KeyFieldName=”Product.Category.CategoryName”), create a hidden column for this complex field. The grid does not render hidden columns, but allows you to get their data on the server side.

    MVC approach:

    settings.Columns.Add("SubRegionInfo.ID").Visible = false;
    

    WebForms approach:

    ASPxGridView1.Columns.Add("SubRegionInfo.ID").Visible = false;
    

Example

WebForms approach:

Note

For a full example, see the ASPxGridView - Selection Using Checkboxes (WebForms) demo.

<dx:ASPxListBox ID="ASPxListBox1" ClientInstanceName="selList" runat="server" Height="250px" Width="100%" />
<dx:ASPxGridView ID="grid" ClientInstanceName="grid" runat="server" DataSourceID="CustomersDataSource" 
    KeyFieldName="CustomerID" Width="100%">
    <Columns>
    ...
    </Columns>
    <ClientSideEvents SelectionChanged="grid_SelectionChanged" />
</dx:ASPxGridView>

MVC approach:

Note

For a full example, see the GridView - Row Selection (MVC) demo.

@Html.DevExpress().ListBox(settings => {
    settings.Name = "SelectedRows";
    settings.Width = Unit.Percentage(100);
    settings.Height = 250;
    settings.Properties.EnableClientSideAPI = true;
    settings.Theme = "MaterialCompactOrange";
}).GetHtml()

Result:

ASPxClientGridView-GetSelectedFieldValue

See Also