Maintining checkbox state between paging

6 posts, 0 answers
  1. Marcus
    Marcus avatar
    8 posts
    Member since:
    Jul 2007

    Posted 02 Feb 2009 Link to this post

    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
  2. Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 02 Feb 2009 Link to this post

    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

  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Sid
    Sid avatar
    2 posts
    Member since:
    Jul 2008

    Posted 23 Oct 2009 Link to this post

    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...
  5. Mark Galbreath
    Mark Galbreath avatar
    171 posts
    Member since:
    Jul 2009

    Posted 04 Feb 2010 Link to this post

    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
  6. Sebastian
    Admin
    Sebastian avatar
    9934 posts

    Posted 05 Feb 2010 Link to this post

    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.
  7. Mark Galbreath
    Mark Galbreath avatar
    171 posts
    Member since:
    Jul 2009

    Posted 05 Feb 2010 Link to this post

    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
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017