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

Maintining checkbox state between paging

5 Answers 132 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Marcus
Top achievements
Rank 1
Marcus asked on 02 Feb 2009, 02:15 PM
Hi,

I have a radgrid with a gridtemplatecolumn and an asp:checkbox inside it. What is the recommended way to maintain the state of these checkboxes between paging through the grid?

Thanks,

Marcus

5 Answers, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 03 Feb 2009, 04:20 AM
Hi Marcus,

Try using the ViewState property on the page to save the CheckBox selection. Go through the following help article which explains more on this.
Persisting CheckBox control state in GridTemplateColumn on rebind

Thanks
Shinu

0
Sid
Top achievements
Rank 1
answered on 23 Oct 2009, 06:08 AM
Hi,

Can you post sample code for this issue with a simple RADDatagrid (without the master/detail).
I have tried with the code given in the link but it doesn't work. I don't think this is a version issue..

thanks and regards...
0
Mark Galbreath
Top achievements
Rank 2
answered on 04 Feb 2010, 10:08 PM
Seriously!  I just need to persist a checkbox on a simple multipaged grid.  The example code is way beyond what I need and it would take me hours to figure out how to adopt it.  Why aren't checkboxes persisted by default?  It seems to me that behavior is so obviously needed that it's incredible it's not built-in!

Cheers!
Mark
0
Sebastian
Telerik team
answered on 05 Feb 2010, 09:07 AM
Hello Mark,

The controls placed in RadGrid templates (GridTemplateColumn in particular) can vary. Since they are not part of built-in grid elements there is no universal means to persist their state on grid rebind as opposed to a regular postback. That is why on explicit or implicit rebind operations (like paging) the controls in the templates are recreated as outlined in this topic but their state is not kept automatically. You can test the same behavior with regular MS GridView control to compare the result.

That is the reason why you need to track the state of the controls in grid templates with your custom logic and retain their previous test on rebind operations. I hope this explanation makes sense.

Kind regards,
Sebastian
the Telerik team

Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Follow the status of features or bugs in PITS and vote for them to affect their priority.
0
Mark Galbreath
Top achievements
Rank 2
answered on 05 Feb 2010, 01:43 PM
Hey Sebastian,
Thanks for the reply, though not very satisfying.  Almost all the online examples using checkboxes create ASP checkboxes in griditemtemplates.  I actually started out with a gridcheckboxcolumn and couldn't get it to work in selecting its row for further processing and switched to the template option, which works great as long as you are not paging and needing persistence.

Oh well, I can write the code; I just prefer to be lazy.

Cheers!
Mark
Tags
Grid
Asked by
Marcus
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Sid
Top achievements
Rank 1
Mark Galbreath
Top achievements
Rank 2
Sebastian
Telerik team
Share this question
or