We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Problems with the Menu Control

I'm adding menu items dynamically in the Page_Load event of a user control.

string url = String.Format("~/Nymex/Details.aspx?nhid={0}", ext.NhId);
MenuItem menuItem = new MenuItem();
menuItem.Text = ext.NhSessiondate.ToString("MMM dd, yyyy (ddd)");
menuItem.NavigateUrl = url;
menuItem.ID = ext.NhId.ToString();
item.Items.Add(menuItem);

When I click on the menu item it just does a postback to whatever page it's on and doesn't go to the NaviageUrl. This worked using the asp:menu control.

All of my other menu items that are defined in the ascx page work fine. I'm only having problems with the ones I add dynamically.

3 Replies

MP Martin Phee June 27, 2007 07:10 PM UTC

I moved the code to populate the menu items to Page_Init and now it seems to work. This is different than how the asp:menu control works and a little unexpected.

Shouldn't it work in the Page_Load?


RR Ramya R Syncfusion Team June 28, 2007 07:10 AM UTC

Hi Marty,

Thank you for your interest in Syncfusion Products.

I was not able to reproduce the issue that you have mentioned here.

Could you please take a look at the attached sample and modify it to reproduce the issue that you have mentioned here and send it back to us, so that it would help us in analyzing this issue?

You can download the sample from the below provided webpage link,
http://websamples.syncfusion.com/samples/Tools.Web/5.1.0.51/F63072/main.htm

Please let me know if you have any queries.

Thanks & Regards,
Ramya.


DD Dharmesh Desai October 17, 2007 01:40 PM UTC

Hi Ramya,

I have experienced a similar problem with the menu control. In my case I had the menu.NavigateUrl = "page.aspx" and it would not work, so I fixed this by using the Target property, which then fixed the issue.

Is there a bug in the control?

Thanks,
Dharmesh Desai
>Hi Marty,

Thank you for your interest in Syncfusion Products.

I was not able to reproduce the issue that you have mentioned here.

Could you please take a look at the attached sample and modify it to reproduce the issue that you have mentioned here and send it back to us, so that it would help us in analyzing this issue?

You can download the sample from the below provided webpage link,
http://websamples.syncfusion.com/samples/Tools.Web/5.1.0.51/F63072/main.htm

Please let me know if you have any queries.

Thanks & Regards,
Ramya.

Loader.
Live Chat Icon For mobile
Up arrow icon