ASPxClientGridView.UnselectRows Method
Deselects rows.
Declaration
UnselectRows(
visibleIndices?: number[] | number
): void
Parameters
Name | Type | Description |
---|---|---|
visibleIndices | number | number[] | The visible indices of rows. |
Remarks
If the visibleIndices
parameter is not specified, the UnselectRows
method deselects all rows in the grid.
For more information on row selection in grid, refer to the following topic: Selection.
Examples
Deselect All Grid Rows
<dx:ASPxGridView ID="MyGridView" ClientInstanceName="grid" runat="server"
OnContextMenuInitialize="GridView_ContextMenuInitialize">
<ClientSideEvents ContextMenuItemClick="OnContextMenuItemClick" />
<%--...--%>
<SettingsBehavior AllowSelectByRowClick="True" />
<SettingsContextMenu Enabled="True" />
</dx:ASPxGridView>
function OnContextMenuItemClick(s, e) {
switch(e.item.name) {
case 'SelectAll':
grid.SelectRows();
break;
case 'DeselectAll':
grid.UnselectRows();
break;
}
}
protected void GridView_ContextMenuInitialize(object sender, ASPxGridViewContextMenuInitializeEventArgs e) {
e.ContextMenu.Items.Add("Select All", "SelectAll");
e.ContextMenu.Items.Add("Deselect All", "DeselectAll");
}
Deselect the Row Specified by Its Visible Index
<dx:ASPxGridView ID="ASPxGridView1" ClientInstanceName="grid" runat="server">
<%--...--%>
</dx:ASPxGridView>
<br />
<dx:ASPxButton ID="ASPxButton1" runat="server" AutoPostBack="False" Text="Unselect row with index #2">
<ClientSideEvents Click="UnselectSecondRow"/>
</dx:ASPxButton>
function UnselectSecondRow(s, e){
grid.UnselectRows(2);
}
Deselect Multiple Rows Specified by Their Visible Indices
<dx:ASPxGridView ID="ASPxGridView1" ClientInstanceName="grid" runat="server">
<%--...--%>
</dx:ASPxGridView>
<br />
<dx:ASPxButton ID="ASPxButton1" runat="server" AutoPostBack="False" Text="Unselect row with indices ##1-3">
<ClientSideEvents Click="UnselectMultipleRows" />
</dx:ASPxButton>
function UnselectMultipleRows(s, e){
var indices = [1, 2, 3];
grid.UnselectRows(indices);
}
See Also