Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1038
  • Last Modified:

MenuItemClick in Menu Contrrol

In ASP.NET 2.0 I have a menucontrol in a Master page.
on Pressing a choice in the menu  I put in MenuItemClick a code that set the NavigateUrl .

 Menu1_MenuItemClick(object sender, MenuEventArgs e)
e.Item.NavigateUrl = ..........

My problem is that I have to press the menuitem TWICE!!!!! in order to get the new choice. When I press the first time it goes to the MenuItemClick and set the new NavigateUrl but it does not switch to the new menuitem. Only
After I press the second time it moves to the new choice. Why is that?
(The problem is not because of the Master Page. It happens also if it is a regular page.)
0
ANAT2403
Asked:
ANAT2403
  • 3
  • 2
1 Solution
 
rundkaasCommented:
Try rebinding the MenuControl
Menu.DataBind();
0
 
ANAT2403Author Commented:
Do you mean to make the DataBind in the end of MenuItemClick?
I did it and it doesn't help.
Have another idea?
I think the problem is that this event is fired after the form load but what can I do about it?
Anat
0
 
rundkaasCommented:
Is it not working fine, only that the logic is wrong?
First you set the navigate URL, then when you press it next time it, go go to that location.
Eiter you need to set the NavigateURL BEFORE pressing the link, or you can just Response.Redirect(..) insted of seting the NavigateURL
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
ANAT2403Author Commented:
I just solvr the problem with Response.Redirect before you mentioned it but as you mentioned it I will give you
The points. This solve my problem.
Anat
0
 
niceoneishereCommented:
Hi rundkass,
can you please tell how to set the navigateurl before pressing link. i am little confused.
Thanks and appreciate it
0
 
rundkaasCommented:
Well the navigate url could be set when the link is created ( e.g. when it is databound) or you add a event handler to it, and then set it to redirect to another page.
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now