Skip to main content

ASPxClientGridView.GetSelectedRowCount Method

Returns the number of selected rows.

Declaration

GetSelectedRowCount(): number

Returns

Type Description
number

The number of selected rows.

Remarks

For more information on row selection in the grid, refer to the following topic: Selection.

Example

The example below adds ASPxLabel to the PagerBar template and calls the client-side GetSelectedRowCount method to display the number of selected rows within the label.

ASPxGridView - GetSelectedRowCount

<dx:ASPxGridView ID="grid" ClientInstanceName="grid" runat="server" AutoGenerateColumns="False">
    <ClientSideEvents SelectionChanged="ShowRowsCount" />
    <Columns>
        <dx:GridViewCommandColumn VisibleIndex="0" ShowSelectCheckbox="true" />
        <%--...--%>
    </Columns>
    <Templates>
        <PagerBar>
            <table>
                <tr>
                    <td>
                        <dx:ASPxGridViewTemplateReplacement ID="Pager" runat="server"
                            ReplacementType="Pager" />
                    </td>
                    <td>
                        <dx:ASPxLabel ID="label" ClientInstanceName="label" runat="server" Text="">
                            <ClientSideEvents Init="ShowRowsCount" />
                        </dx:ASPxLabel>
                    </td>
                </tr>
            </table>
        </PagerBar>
    </Templates>
</dx:ASPxGridView>
function ShowRowsCount(s, e) {
    label.SetText('Selected rows count: ' + grid.GetSelectedRowCount());
}

Online Example

View Example: How to edit multiple selected rows in a single edit form

See Also