HELP..! ASP.NET 2.0 MasterPage and menu Question..

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a masterpage define that contains a asp:menu control. My menu control
has items that do not have a NavigateUrl assigned which causes them to
postback on the current page...

Now the issue is that when they postback the MasterPage is rendered last and
the MenuItemClick event on the menu control doesn't fire until after the
Page_Load event fires...

How can I capture the MenuItemClick prior to the Page_Load...
 
No, I need to be able to capture which menu item was clicked; specifically
the menu items value...

Like...

protected void ctl_Menu_MenuItemClick(object sender, MenuEventArgs e)
{
Helper.menuAction = Convert.ToInt16(e.Item.Value);
}
 
Right, but there is no way to reorder the event processing - Page_Load
is going to execute before the click event. Since your logic is
factored into a nice helper class couldn't you move to processing
outside of Page_Load?
 
Not sure I follow... Could you provide an example...

I'm willing to try anything at this point
 
I mean something like:

protected void Page_Load(object sender, EventArgs e)
{
if(!IsPostBack)
{
Helper.DisplaySomethingOnScreen();
}
}

protected void ctl_Menu_MenuItemClick(...)
{
Helper.DisplaySomethingOnScreen(Convert.ToInt16(e.Item.Value));
}
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top