ASPxClientGridView.UnselectRows Method
Deselects the specified row (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
Examples
- ASPxClientGridView.UnselectRows():
The code sample below demonstrates how to provide the default grid context menu with two custom items. To add the items to the item collection, the FillContextMenuItems event is used. On the client-side, the ContextMenuItemClick event is handled to respond to a custom item click.
<dx:ASPxGridView ID="MyGridView" runat="server" AutoGenerateColumns="False" DataSourceID="AccessDataSource" ClientInstanceName="myGrid" KeyFieldName="ProductID" OnFillContextMenuItems="MyGridView_FillContextMenuItems">
<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_FillContextMenuItems(object sender, ASPxGridViewContextMenuEventArgs e) {
e.Items.Add("Select All", "SelectAll");
e.Items.Add("Deselect All", "DeselectAll");
}
- 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>
- 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>
See Also