ASPxClientGridView.UnselectRows Method

Deselects the specified row(s) (if selected) within the grid.

Declaration

UnselectRows(
    visibleIndices?: number[] | number
): void

Parameters

Name Type Description
visibleIndices number[] | number

Visible indices of rows to unselect.

Remarks

Concept

Selection

Examples

  • ASPxClientGridView.UnselectRows():

The code sample below demonstrates how to add two custom items to the default grid context menu. To populate the item collection with items, handle the ContextMenuInitialize event. The ContextMenuItemClick client-side event handler responds to clicks on custom items.

<dx:ASPxGridView ID="MyGridView" runat="server" AutoGenerateColumns="False" DataSourceID="AccessDataSource" ClientInstanceName="myGrid" KeyFieldName="ProductID" OnContextMenuInitialize="MyGridView_ContextMenuInitialize">
     <ClientSideEvents ContextMenuItemClick="function(s, e) {
          switch(e.item.name) {    
               case 'SelectAll':
                    myGrid.SelectRows();
                    break;
               case 'DeselectAll':
                    myGrid.UnselectRows();
                    break;
          }
     }" />
     <Columns>
          ...
     </Columns>
     <SettingsBehavior AllowSelectByRowClick="True" />
     <SettingsContextMenu Enabled="True">
     </SettingsContextMenu>
</dx:ASPxGridView>
protected void MyGridView_ContextMenuInitialize(object sender, ASPxGridViewContextMenuInitializeEventArgs e) {
     e.ContextMenu.Items.Add("Select All", "SelectAll");
     e.ContextMenu.Items.Add("Deselect All", "DeselectAll");
}

GridView - Context Menu

  • ASPxClientGridView.UnselectRows(Int32):
<dx:ASPxGridView ID="ASPxGridView1" runat="server" ClientInstanceName="grid" ...>
    <Columns>
    ...
    </Columns>
</dx:ASPxGridView>
<br />
<dx:ASPxButton ID="ASPxButton1" runat="server" AutoPostBack="False" Text="Unselect row with index #2" Theme="Office365">
    <ClientSideEvents Click="function(s, e) {
      grid.UnselectRows(2);
    }" />
</dx:ASPxButton>

GridView - UnselectRows(Int32) Method

  • ASPxClientGridView.UnselectRows(Int32[]):
<dx:ASPxGridView ID="ASPxGridView1" runat="server" ClientInstanceName="grid" ...>
    <Columns>
    ...
    </Columns>
</dx:ASPxGridView>
<br />
<dx:ASPxButton ID="ASPxButton1" runat="server" AutoPostBack="False" Text="Unselect row with index #2" Theme="Office365">
    <ClientSideEvents Click="function(s, e) {
      var indices = [1, 2, 3];
      grid.UnselectRows(indices);
    }" />
</dx:ASPxButton>

GridView - UnselectRows(Int32[]) Method

See Also