The requested page is not available for the requested platform. You are viewing the content for Default platform.

ASPxClientGridView.GetVisibleRowsOnPage Method

Returns the number of rows actually displayed within the active page.

Declaration

GetVisibleRowsOnPage(): number

Returns

Type Description
number

An integer value that specifies the number of rows displayed within the active page.

Remarks

Use the GetVisibleRowsOnPage method to get the number of rows that are currently visible on the page.

Examples

This example demonstrates how to use the GetSelectedKeysOnPage and GetVisibleRowsOnPage methods to prevent a user from deleting all rows on a single grid page (if editing logic requires it). To do this, you can compare the array length of keys obtained through GetSelectedKeysOnPage client method (returns keys only on a visible page) and the number of rows on a page obtained through GetVisibleRowsOnPage client method.

<script>
    function DeleteSelectedRows(s, e) {
        var keys = GridView.GetSelectedKeysOnPage();
        var rowsCount = GridView.GetVisibleRowsOnPage();
        if (keys.length == rowsCount) {
            alert('You cannot delete all rows on a page!');
            GridView.UnselectRowsByKey(keys);
        } else {
            if (confirm('Are you sure you want to delete rows with keys: [' + keys.toString() + ']')) {
                alert('Data editing is not allowed in this demo!');
                keys.forEach(function (key, index) {
                    GridView.DeleteRowByKey(key);
                });
            }
        }
    };
</script>
See Also