Click here to Skip to main content
11,482,402 members (72,628 online)
Rate this: bad
good
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 4-Oct-12 0:40am
Kunjammu1.1K
Edited 4-Oct-12 1:07am
DaveAuld181.9K
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 at 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 at 4-Oct-12 6:47am
   
How i can add menuitemclick event dynamically from code...can u plz tell me?
Mohd. Mukhtar at 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 at 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 at 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 at 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)



Advertise | Privacy | Mobile
Web04 | 2.8.150520.1 | Last Updated 4 Oct 2012
Copyright © CodeProject, 1999-2015
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