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

radtreeview with checkbox

1 Answer 51 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
Federik
Top achievements
Rank 1
Federik asked on 29 Jun 2012, 09:00 AM
Hi,

I need a radtreeview with checkboxes which allow to check a child only if its parent is checked.

Thanks & regards
Federik

1 Answer, 1 is accepted

Sort by
0
Accepted
Princy
Top achievements
Rank 2
answered on 29 Jun 2012, 10:08 AM
Hi Federik,

Try the following Javascript to achieve your scenario.

JS:
<script type="text/javascript">
 function OnClientNodeChecking(sender, args)
  {
    if ((args.get_node().get_level() != 0) && (!args.get_node().get_parent().get_checked()))
    {
        args.set_cancel(true);
    }
    if (args.get_node().get_checked())
    {
        var nodes = args.get_node().get_allNodes();
        for (var i = 0; i < nodes.length; i++)
      {
        nodes[i].uncheck();
      }
    }
  }
</script>

Thanks,
Princy.
Tags
TreeView
Asked by
Federik
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Share this question
or