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

Disable top menu item?

1 Answer 100 Views
Menu
This is a migrated thread and some comments may be shown as answers.
Josh
Top achievements
Rank 1
Josh asked on 20 May 2008, 12:24 AM
Top Menu Item
    - Action A   
    - Action B

I've got a radmenu, using onitemclick to handle events on the server - is there anyway to disable postback for the top menu item so there is only post back when clicking one of the items? Can't seem to find an easy solution for this...

1 Answer, 1 is accepted

Sort by
0
Accepted
Simon
Telerik team
answered on 22 May 2008, 04:39 PM
Hello Josh,

Thank you for writing to us.

There are two ways of accomplishing this:
  1. Set the PostBack property to false of those Items which you do not want to do a postback upon clicking:
    <telerik:RadMenuItem Text="Text" Value="Value" PostBack="false"></telerik:RadMenuItem> 
  2. Handle the OnClientItemClicking client-side event and cancel the event if the clicked Item is a root Item (canceling the OnClientItemClickcing event will prevent the postback):
            function OnClientItemClicking(sender, eventArgs) 
            { 
                var item = eventArgs.get_item(); 
                 
                var rootItems = sender.get_items(); 
                 
                if (rootItems.indexOf(item) > -1) 
                { 
                    eventArgs.set_cancel(true); 
                } 
            } 
You could read more about the client-side functions and events used here:
I have also attached a sample project which demonstrates both approaches described above.

I hope this helps.

Sincerely yours,
Simon
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
Tags
Menu
Asked by
Josh
Top achievements
Rank 1
Answers by
Simon
Telerik team
Share this question
or