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

Discussion in 'ASP .Net' started by Scott Allen, Sep 20, 2005.

  1. Scott Allen

    Scott Allen Guest

    Can you just skip the processing in Page_Load by checking the
    IsPostBack property?

    --
    Scott
    http://www.OdeToCode.com/blogs/scott/

    On Tue, 20 Sep 2005 09:16:15 -0700, "Fuehner"
    <> wrote:

    >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...
    Scott Allen, Sep 20, 2005
    #1
    1. Advertising

  2. 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);
    }



    "Scott Allen" wrote:

    > Can you just skip the processing in Page_Load by checking the
    > IsPostBack property?
    >
    > --
    > Scott
    > http://www.OdeToCode.com/blogs/scott/
    >
    > On Tue, 20 Sep 2005 09:16:15 -0700, "Fuehner"
    > <> wrote:
    >
    > >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...

    >
    >
    =?Utf-8?B?RnVlaG5lcg==?=, Sep 20, 2005
    #2
    1. Advertising

  3. Scott Allen

    Scott Allen Guest

    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?

    --
    Scott
    http://www.OdeToCode.com/blogs/scott/

    On Tue, 20 Sep 2005 13:26:03 -0700, "Fuehner"
    <> wrote:

    >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);
    > }
    >
    >
    >
    Scott Allen, Sep 21, 2005
    #3
  4. Not sure I follow... Could you provide an example...

    I'm willing to try anything at this point

    "Scott Allen" wrote:

    > 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?
    >
    > --
    > Scott
    > http://www.OdeToCode.com/blogs/scott/
    >
    > On Tue, 20 Sep 2005 13:26:03 -0700, "Fuehner"
    > <> wrote:
    >
    > >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);
    > > }
    > >
    > >
    > >

    >
    >
    =?Utf-8?B?RnVlaG5lcg==?=, Sep 21, 2005
    #4
  5. Scott Allen

    Scott Allen Guest

    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));
    }


    --
    Scott
    http://www.OdeToCode.com/blogs/scott/

    On Wed, 21 Sep 2005 13:37:04 -0700, "Fuehner"
    <> wrote:

    >Not sure I follow... Could you provide an example...
    >
    >I'm willing to try anything at this point
    >
    >"Scott Allen" wrote:
    >
    >> 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?
    >>
    >> --
    >> Scott
    >> http://www.OdeToCode.com/blogs/scott/
    >>
    >> On Tue, 20 Sep 2005 13:26:03 -0700, "Fuehner"
    >> <> wrote:
    >>
    >> >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);
    >> > }
    >> >
    >> >
    >> >

    >>
    >>
    Scott Allen, Sep 22, 2005
    #5
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. =?Utf-8?B?QWxleCBNYWdoZW4=?=

    MasterPage -> Page -> MasterPage Code Access

    =?Utf-8?B?QWxleCBNYWdoZW4=?=, Apr 10, 2006, in forum: ASP .Net
    Replies:
    3
    Views:
    7,863
    Steven Cheng[MSFT]
    Apr 14, 2006
  2. ThunderMusic
    Replies:
    2
    Views:
    427
    Gregory Gadow
    Sep 27, 2006
  3. Randy Smith
    Replies:
    2
    Views:
    406
    Randy Smith
    Oct 21, 2006
  4. Randy Smith
    Replies:
    9
    Views:
    407
    Mark Rae
    Apr 14, 2007
  5. mr t
    Replies:
    0
    Views:
    384
Loading...

Share This Page