This is a migrated thread and some comments may be shown as answers.

[Solved] Selecting All Records in a Paginated RadGrid

1 Answer 422 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Jason Zam
Top achievements
Rank 1
Jason Zam asked on 16 Dec 2009, 09:55 PM
Hello,

I have a RadGrid on my webpage which has paging enabled, I also use the GridClientSelectColumn in order to select all displayed records.  Here is an example:

<telerik:RadGrid ID="radgrdEvaluator" AutoGenerateColumns="False" AllowPaging="True" AllowMultiRowSelection="True" PageSize="10" runat="server">  
    <MasterTableView DataKeyNames="EvaluatorID" ShowHeadersWhenNoRecords="True">  
    <Columns> 
        <telerik:GridClientSelectColumn UniqueName="ClientSelectColumn">  
        <HeaderStyle Width="30px" HorizontalAlign="Center" /> 
        <ItemStyle Width="30px" HorizontalAlign="Center" /> 
        </telerik:GridClientSelectColumn> 
        <telerik:GridBoundColumn DataField="EvaluatorID" HeaderText="EvaluatorID" UniqueName="EvaluatorIDData"></telerik:GridBoundColumn> 
    </Columns> 
    </MasterTableView> 
    <ClientSettings EnableRowHoverStyle="True">  
    <Selecting AllowRowSelect="True" /> 
    </ClientSettings> 
    <pagerstyle mode="NextPrevAndNumeric" AlwaysVisible="True" /> 
</telerik:RadGrid> 

In this example let's say I have 30 records that are returned but I have set the PageSize to 10 which would give me 3 pages of results.  When I click the "select all" checkbox it only selects the 10 records of the displayed page.  How can I get it so that the "select all" checkbox selects all 30 records, and not just the 10 displayed records without having to increase the PageSize property? 

Thanks!
Jason

1 Answer, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 17 Dec 2009, 05:34 AM
Hello Jason,

When paging is enabled in the grid, a solution would be to temporarily disable paging, loop through all the items in the grid, select the items and then enable paging back.
Also the following forum links discuss on a similar issue as yours. Take a look at these as well:
GridClientSelectColumn doesn't maintain state when paging
How to preserve the state of the rows selected during traversal to other pages

Hope this helps..
Princy.
Tags
Grid
Asked by
Jason Zam
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Share this question
or