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

Maintaining Checkbox State through paging

3 Answers 207 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Bob Reselman
Top achievements
Rank 1
Bob Reselman asked on 24 Mar 2008, 11:51 PM
Hi:

I have an ajaxified RadGrid in which have AllowPaging=true and have added an ASP:CheckBox control within a GridTemplateColumn like so:

<telerik:GridTemplateColumn UniqueName="tagItem" AllowFiltering="false"             HeaderText="Tag">
        <ItemTemplate>
            <asp:CheckBox ID="CheckBox1"
            runat="server"
            AutoPostBack="true"
            OnCheckedChanged="Check_Changed" />
    </ItemTemplate>
</telerik:GridTemplateColumn>

When I use the pager to traverse to data, the state of the CheckBox(s).Checked property in a previous page is not maintained.

For example, if I am on Page 1 and I check a checkbox , go to Page 2 and then return to Page 1, the checkbox that I checked on Page 1 will no longer be checked.

It is really important that I be able to set as many checks in as many pages as I like and maintain check state throughout the grid.

Any help will be greatly appreciated.

Thanks in advance,
Bob Reselman

3 Answers, 1 is accepted

Sort by
0
Vlad
Telerik team
answered on 25 Mar 2008, 07:32 AM
Hi Bob,

Please check this article:
http://www.telerik.com/help/radcontrols/prometheus/grdPersistSelectedRowsOnSorting.html

All the best,
Vlad
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
Tad Richard
Top achievements
Rank 1
answered on 02 May 2008, 10:23 PM
Vlad,

I have a similar problem to Bob -- I want to maintain the checked state of the checkboxes.  But I don't wsant to have to suffer a postback (even in AJAX) for each checkbox checked.

I notice that if I replace the checkbox with a textbox, the data entered into the textbox is lost when paging away from and then back to the current page, similar to the checkbox. 

Shouldn't the controls in template columns maintain their state across page views? 

--Tad
0
Nikita Gourme
Top achievements
Rank 1
answered on 04 May 2008, 04:03 PM
Tad,

I do not think that the checked state of the checkboxes can be persisted client-side without submit to the server. You can  implement  the state persistence with custom code and combine that with ajax to simulate client performance - I found this article which explains how to do it:

Help topic

Concerning the missing text in the templated controls:
I think that the MS GridView control will behave in the same way since the state of the templated controls is lost on internal rebind action as the paging.

Nikita
Tags
Grid
Asked by
Bob Reselman
Top achievements
Rank 1
Answers by
Vlad
Telerik team
Tad Richard
Top achievements
Rank 1
Nikita Gourme
Top achievements
Rank 1
Share this question
or