Phaneendra
                                            
                                    
    Top achievements
    
            
                
                Rank 1
            
    
                                        
                                        Phaneendra
                                        asked on 27 Apr 2012, 06:37 AM
                                    
                                Hi,
I have a RadTreeView, binded from database of 5 Levels.
Handling the Node click from client side, now I'm facing an issue, if the Node level is 2 I have to block the node click no post back should happend when user clicks on that node.
Regards
Krishna
                                I have a RadTreeView, binded from database of 5 Levels.
Handling the Node click from client side, now I'm facing an issue, if the Node level is 2 I have to block the node click no post back should happend when user clicks on that node.
Regards
Krishna
4 Answers, 1 is accepted
0
                                
                                                    Shinu
                                                    
                                            
    Top achievements
    
            
                
                Rank 2
            
    
                                                
                                                answered on 27 Apr 2012, 07:33 AM
                                            
                                        Hi Krishna,
Try the following code to block the node click from client side.
JS:
Thanks,
Shinu.
                                        Try the following code to block the node click from client side.
JS:
<script type="text/javascript">    function OnClientNodeClicking(sender, args)    {        if (args.get_node().get_level() == 2)            args.set_cancel(true);    }</script>Thanks,
Shinu.
0
                                
                                                    Phaneendra
                                                    
                                            
    Top achievements
    
            
                
                Rank 1
            
    
                                                
                                                answered on 27 Apr 2012, 09:45 AM
                                            
                                        Hi shinu
Code snipplet is not working, getting error, object doesn't support
Thanks
Krishna
                                        Code snipplet is not working, getting error, object doesn't support
Thanks
Krishna
0
                                Accepted
                                                    Shinu
                                                    
                                            
    Top achievements
    
            
                
                Rank 2
            
    
                                                
                                                answered on 27 Apr 2012, 10:56 AM
                                            
                                        Hi Krishna,
Here is the code that worked for me as expected.
ASPX:
JS:
Please provide your full code if it doesn't helps.
Thanks,
Shinu.
                                        Here is the code that worked for me as expected.
ASPX:
<telerik:RadTreeView ID="RadTreeView1" runat="server" DataTextField="name" DataFieldID="id" DataSourceID="SqlDataSource1" DataFieldParentID="parent" OnClientNodeClicking="OnClientNodeClicking"></telerik:RadTreeView>JS:
<script type="text/javascript">    function OnClientNodeClicking(sender, args)    {        if (args.get_node().get_level() == 2)            args.set_cancel(true);    }</script>Please provide your full code if it doesn't helps.
Thanks,
Shinu.
0
                                Accepted
                                                    Avinash Tauro
                                                    
                                            
    Top achievements
    
            
                
                Rank 1
            
    
                                                
                                                answered on 18 May 2012, 03:27 PM
                                            
                                        This solution works partially. So set_cancel(true) in node clicking correctly prevents postback but also prevents the node from being selected.
Adding args.get_node().set_selected(true); in the function selects the node.
                                        Adding args.get_node().set_selected(true); in the function selects the node.