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

I have an ASP.NET menu. I am adding menu items dynamically like below

C#
this.LeftMenu.Items.Add(new MenuItem(Item1, "", "", navigationURL + this.Page.Request.Url.Query.ToString()));


But when click on this menu item, the MenuItemClick event not firing.

Can Anybody help me to solve this issue....?

Thanks in advance
Kunjammu
Posted
Updated 4-Oct-12 0:07am
v2

In the menu properties, there must be an autopostback property.... set this property to TRUE.

This might solve your issue !
 
Share this answer
 
v2
Comments
Kunjammu 4-Oct-12 6:33am    
no autopostback property for menu control.....
If you are adding menu item dynamically. You should also add event with the menu item like click event and that method should be defined.
 
Share this answer
 
Comments
Kunjammu 4-Oct-12 6:47am    
How i can add menuitemclick event dynamically from code...can u plz tell me?
Mohd. Mukhtar 4-Oct-12 6:58am    
MenuItem menu = new MenuItem(Item1, "", "", navigationURL + this.Page.Request.Url.Query.ToString());
//Add event and property here in menu

this.LeftMenu.Items.Add(menu);

The below link may help you more.

http://msdn.microsoft.com/en-us/library/system.windows.forms.menuitem.aspx
Kunjammu 4-Oct-12 7:11am    
this link is talking about windows application... i want to do this in my web application... is there any other way...?
Mohd. Mukhtar 4-Oct-12 7:20am    
Can you please check html code in the brwser which is generating after page load.

And check the menu item html what code has been added into that.
Kunjammu 4-Oct-12 7:38am    
.ctl00_LeftMenu_0 { background-color:white;visibility:hidden;display:none;position:absolute;left:0px;top:0px; }
.ctl00_LeftMenu_1 { text-decoration:none; }
.ctl00_LeftMenu_2 { }
.ctl00_LeftMenu_3 { border-style:none; }
.ctl00_LeftMenu_4 { }
.ctl00_LeftMenu_5 { border-style:none; }
.ctl00_LeftMenu_6 { }
.ctl00_LeftMenu_7 { border-style:none; }
.ctl00_LeftMenu_8 { }
this is the code

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