Skip to main content
Tab

ASPxGridBase.GetFilteredSelectedValues(String[]) Method

Returns the field values of selected data items (rows, cards or records) that match the filter criteria.

Namespace: DevExpress.Web

Assembly: DevExpress.Web.v24.1.dll

NuGet Package: DevExpress.Web

Declaration

public List<object> GetFilteredSelectedValues(
    params string[] fieldNames
)

Parameters

Name Type Description
fieldNames String[]

The names of data source fields.

Returns

Type Description
List<Object>

The list of field values.

Remarks

The GetFilteredSelectedValues method allows you to get the values of selected data items (rows, cards, or records) that match the filter criteria. To get the values of all selected data items, call the GetSelectedFieldValues(String[]) method.

The example below demonstrates how to unselect rows hidden by the filter in the Grid View control:

<dx:ASPxGridView ID="Grid" runat="server" DataSourceID="ProductsDataSource" KeyFieldName="OrderID">
    <Settings ShowFilterRow="true" />
    <Columns>
        <dx:GridViewCommandColumn ShowSelectCheckbox="true" />
        <dx:GridViewDataSpinEditColumn FieldName="UnitPrice" />
        <dx:GridViewDataSpinEditColumn FieldName="Quantity" />
        <dx:GridViewDataSpinEditColumn FieldName="Discount" />
    </Columns>
</dx:ASPxGridView>
<dx:ASPxButton runat="server" id="ASPxButton1" Text="Unselect rows hidden by the filter" 
    OnClick="UnselectFilteredOutRows">
</dx:ASPxButton>
protected void UnselectFilteredOutRows(object sender, EventArgs e) {
    List<object> selectedKeys = Grid.GetSelectedFieldValues(Grid.KeyFieldName);
    List<object> filteredSelectedKeys = Grid.GetFilteredSelectedValues(Grid.KeyFieldName);
    foreach(var selectedKey in selectedKeys)
        if(!filteredSelectedKeys.Contains(selectedKey))
            Grid.Selection.UnselectRowByKey(selectedKey);
} 

For more information on row selection in a particular control, refer to the following topics:

See Also