Skip Navigation LinksHome / Community & Support / Developer Productivity Tools Forums / ASP.NET AJAX > TreeView > Checkboxes in Tree Acting Like Radio Buttons

Not answered Checkboxes in Tree Acting Like Radio Buttons

Feed from this thread
  • Marbry Intermediate avatar

    Posted on Jan 27, 2012 (permalink)

    I have a treeview with a number of nodes that contain various editing controls that are generated from templates.  The problem is that the checkboxes are being treated like radio buttons as it will only allow one at a time to be checked.  When I check one, it appears the tree automatically unchecks any others in the entire tree, firing the checkchanged handler for each in its template.

    This only seems to be exhibited when a checkbox is clicked, I can generate the tree with multiple check boxes checked, but as soon as you check one I see this behavior.

    All the checkboxes have unique ID's.

    When I place several checkboxes on the same page with their own checkchanged handlers, but outside of the tree, they do not demonstrate this behavior amongst themselves.  Although even checking one of these, the ones in the tree do.

    I added some code to the checkchanged handlers in the templates and checked the __EVENTTARGET param and kicked it out of any that didn't match the ID of the sender.  This kept the underlying data correct, but when the page regenerates all the other checkboxes are still unchecked.  This would seem to imply that the tree is somehow forcing this on the controls when they're rendered.

    If not I don't know where else this would be coming from.  Any insight is appreciated though.

    Reply

  • Bozhidar Bozhidar admin's avatar

    Posted on Jan 30, 2012 (permalink)

    Hi Marbry,

    Unfortunately the information provided isn't enough to troubleshoot the problem. Could you try to simplify the markup of your page and paste it here, or try to open a support thread and isolate the problem in a sample project and attach it there. 
     
    All the best,
    Bozhidar
    the Telerik team
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now

    Reply

  • Marbry Intermediate avatar

    Posted on Jan 30, 2012 (permalink)

    The tree content is all generated in code.  I'll see if I can put something together that replicates the problem.

    Reply

  • Bozhidar Bozhidar admin's avatar

    Posted on Jan 31, 2012 (permalink)

    Hi,

    Just to notify anyone else, that may come across this issue. I've inspected the code provided by Marbry and it turns out that he was disabling the checkboxes. When the ASP CheckBox control is disabled, it's checked state is not stored in the viewstate, wich is why on every postback they appear unchecked. To overcome this behavior, you have to use either a hidden field, or some other mechanism to store the checked state of the checkbox, and then reproduce it when the page is loaded.
     
    Greetings,
    Bozhidar
    the Telerik team
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now

    Reply

Back to Top

Skip Navigation LinksHome / Community & Support / Developer Productivity Tools Forums / ASP.NET AJAX > TreeView > Checkboxes in Tree Acting Like Radio Buttons
Related resources for "Checkboxes in Tree Acting Like Radio Buttons"

ASP.NET TreeView Features  |   Documentation   |  Demos  |  Telerik TV  |  Self-Paced Trainer  |  Step-by-step Tutorial  ]