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

Panel bar. Disable postback for items that have child nodes.

2 Answers 92 Views
PanelBar
This is a migrated thread and some comments may be shown as answers.
Michael Finch
Top achievements
Rank 1
Michael Finch asked on 04 Aug 2008, 04:35 PM

In the TreeView control it is possible to disable postbacks on nodes that have children but still allow these nodes to be expanded. This is achieved as follows:

// server side
RadTreeView1.OnClientNodeClicking = "ClientNodeClicking";

//client side
function ClientNodeClicking(sender, eventArgs)
{
 var node = eventArgs.get_node();
 if(node.get_nodes().get_count() > 0)
 {
  eventArgs.set_cancel(true);
 }
}

Is it possible to achieve the same thing with the panelBar control?

2 Answers, 1 is accepted

Sort by
0
Rosi
Telerik team
answered on 05 Aug 2008, 06:52 AM
Hello Michael ,

You can do this by two ways:

1.Just set the PostBack property of these items to False.
2
.Hook on the OnClientItemClicking event and execute the following code:
<script type="text/javascript">  
    function OnClientItemClicking(sender,e)  
    {  
        var item = e.get_item();   
         if(item.get_items().get_count() > 0)   
         {   
           e.set_cancel(true);   
           if(!item.get_expanded())  
           {  
             item.expand();  
           }  
           else  
           {  
             item.collapse();  
           }  
         }   
    }  
    </script> 


Regards,
Rosi
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Michael Finch
Top achievements
Rank 1
answered on 05 Aug 2008, 08:29 AM
That's great Rosi.

Thanks for the quick response.
Tags
PanelBar
Asked by
Michael Finch
Top achievements
Rank 1
Answers by
Rosi
Telerik team
Michael Finch
Top achievements
Rank 1
Share this question
or