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.)
ANAT2403Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

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

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Get your problem seen by more experts

Be seen. Boost your question’s priority for more expert views and faster solutions

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
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
ASP.NET

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.