473,382 Members | 1,409 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,382 software developers and data experts.

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

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...
Nov 19 '05 #1
5 3724
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"
<Fu*****@discussions.microsoft.com> 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...


Nov 19 '05 #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"
<Fu*****@discussions.microsoft.com> 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...


Nov 19 '05 #3
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"
<Fu*****@discussions.microsoft.com> 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);
}


Nov 19 '05 #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"
<Fu*****@discussions.microsoft.com> 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);
}


Nov 19 '05 #5
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"
<Fu*****@discussions.microsoft.com> 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"
<Fu*****@discussions.microsoft.com> 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);
> }
>
>
>



Nov 19 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: dawg1998 | last post by:
I have a page that creates dynamic textboxes based on the number of fields a user chooses to fill out. This process worked great when the page was standalone. However, when I move to a...
0
by: VB Programmer | last post by:
I used Photoshop/Image Ready to create rollover buttons (for a nav menu). They work great. But, when I take the html, including the javascript and put it in a MasterPage, when I view the page...
5
by: Nick Wouters | last post by:
Dear All In Classic ASP I used CSS for ALL layout. Now in ASP.NET version 2 I am testing out Masterpages as they come in very handy. It seems like it is replacing CSS for layout but what is...
5
by: Islamegy® | last post by:
In my project i have two master page which i change dynamic in runtime.. The first one with 1 ContentPanel "onepanel.master", the second with 2 contentPanel"twopanel.master".. but when i switch...
11
by: simon | last post by:
Hello, I'm helping write a .net app, we are using VS2005 and asp/vb.net for code we are using the "masterPage.master" technique, within the masterpage we have an asp:contentplaceholder that is...
7
by: Bon | last post by:
Dear all I create a master page with image buttons on the left-hand side for navigation. When a user clicks the student button, the content (i.e. ContentPlaceholder) in masterpage will be...
2
by: Frank Milverckowitz | last post by:
Hi, New to .NET... question about Masterpages vs. using Frameset I'm using Visual Studio 2005 and notice that the generated pages are of DTD/Doctype that don't support framesets. To use...
3
by: Tor Inge Rislaa | last post by:
I have a MasterPage containing a TreeView menu. When clicking a menu item, a page is loaded into the ContentPlaceHolder. It seems like both the MasterPage and the page in the ContentPlaceHolder is...
1
by: =?Utf-8?B?bWFya203NQ==?= | last post by:
There is probably some simple answer to my question, but i'm still new to this a bit.. I have a master page.. with a menu system which is coded onto the masterpage.aspx... it uses A tags with...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.