Click here to Skip to main content
15,921,905 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi All,

Read in the forums that asp.net menu control's ItemClick event doesn't fire when Navigate url property is set but didn't find any alternate work around. I have some code in MenuItemClick event and also I need the navigate url for the menu item. any ways to do this? your inputs will be appreciated.

Thanks in Advance.
Posted
Updated 21-Jun-11 1:45am
v2

The same thing happens on buttons. I did it this way:

0) If the page you're navigating FROM, create a public method that contains the processing you need to execute.

1) In the page you're navigating TO, call the method created in the previous step from the Page_Load method like this :

C#
((MyPreviousPage)(Page.PreviousPage)).MyPublicMethod();


It ain't pretty, but it works (assuming that both pages are on the same web site).
 
Share this answer
 
v2
Comments
NishaPai 21-Jun-11 7:48am    
Thanks for the reply. I'll try this.
http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.menu.menuitemclick.aspx[^]


VB
<asp:menu id="NavigationMenu"
       staticdisplaylevels="2"
       staticsubmenuindent="10"
       orientation="Vertical"
       onmenuitemclick="NavigationMenu_MenuItemClick"
       runat="server">
 
Share this answer
 
Hope this[^] might help you.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900