Search code examples
asp.nettelerikradtreeview

Disable/enable clientside all checkboxes in a Telerik RadTreeView


I need to disable all checkboxes that I have in telerik RadTree. How I could achieve that?

Trick is, these are not HTML controls but seem to be something imitating these via images, CSS and javascript. For instance, HTML for a RadTreeView node looks like:

  <div class="rtMid">
  <span class="rtSp"></span>
  <span class="rtMinus"></span>
  <span class="rtUnchecked"></span>
  <span class="rtIn">Item text</span>
  </div> 

Best, Askar


Solution

  • Simply redefine its onclick javascript event so it doesn't fire.

    This is supposed to work in every browser:

    onclickEvent = "if (event.cancelable) {event.preventDefault();}else {event.returnValue = false;} return false;";
    

    This is what I think is the best cross-browser solution:

    onclickEvent = "this.checked = !this.checked;";