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

Limited max count when checking the checkbox

1 Answer 64 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
Tommy
Top achievements
Rank 1
Tommy asked on 17 Mar 2009, 09:12 AM
Hi Team,
    I have set the checkbox value is true also can checked succeed,but I want to limit the max checked count in my treeview.
Can you give me a hand?  thank .

1 Answer, 1 is accepted

Sort by
0
Accepted
Shinu
Top achievements
Rank 2
answered on 17 Mar 2009, 11:02 AM
Hello Tommy,

I guess you want to cancel the TreeNode checking if a particular count reached. If that the case, you can try the following client side code. Attach function to the OnClientNodeChecking event of RadTreeView.

JavaScript:
<script type="text/javascript"
function OnClientNodeChecking(sender, args) 
     var tree = $find("<%= RadTreeView1.ClientID %>"); 
     var checkedNodes = tree.get_checkedNodes(); 
     if(!args.get_node().get_checked()) 
     { 
         if((checkedNodes.length)>2) 
         { 
            alert ("Max limit reached, Cannot check the node"); 
            args.set_cancel(true); 
         } 
     }      
</script> 

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