Click here to Skip to main content
12,450,981 members (25,117 online)
Rate this:
 
Please Sign up or sign in to vote.
See more: C# ASP.NET
Hi,

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

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 3-Oct-12 23:40pm
Kunjammu1.1K
Updated 4-Oct-12 0:07am
DaveAuld187.6K
v2
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 1

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

This might solve your issue !
  Permalink  
v2
Comments
Kunjammu 4-Oct-12 6:33am
   
no autopostback property for menu control.....
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 2

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.
  Permalink  
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)

  Print Answers RSS
Top Experts
Last 24hrsThis month


Advertise | Privacy | Mobile
Web02 | 2.8.160826.1 | Last Updated 4 Oct 2012
Copyright © CodeProject, 1999-2016
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100