473,396 Members | 1,898 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,396 software developers and data experts.

How to handle menu post back with master page?


Hi,

I have a master page which contains a menu,i would like to handle post
back
In the content pages(MenuItemClick event)

I tried to do the following in the content page

BaseLayout master = this.Master as BaseLayout;
master.MainMenu.MenuItemClick += new
MenuEventHandler(MainMenu_MenuItemClick); //MainMenu us a property my
master page

But i dont get the events,note that if i am doing the same in the
master page it is ok

Thanks in advance.

Oct 29 '06 #1
1 2883
I suspect you must have switched autoeventwireup to false on the content
page. BTW, you can use <%@ MasterType %directive on content pages to
instruct compiler to automatically generate strongly-typed Master property.
Regardless your approach should work, you can also intercept menu click using
RaiseBubbleEvent method on master page, and then overriding OnBubbleEvent
method as follows:

master page:

protected void Menu_MenuItemClick(object sender, MenuEventArgs e)
{
RaiseBubbleEvent(sender, e);
}
content page:

protected override bool OnBubbleEvent(object source, EventArgs args)
{
if (args is MenuEventArgs)
{
// take appropriate action
}
else
{
return base.OnBubbleEvent(source, args);
}
}

hope this helps
--
Milosz Skalecki
MCAD
"tomix" wrote:
>
Hi,

I have a master page which contains a menu,i would like to handle post
back
In the content pages(MenuItemClick event)

I tried to do the following in the content page

BaseLayout master = this.Master as BaseLayout;
master.MainMenu.MenuItemClick += new
MenuEventHandler(MainMenu_MenuItemClick); //MainMenu us a property my
master page

But i dont get the events,note that if i am doing the same in the
master page it is ok

Thanks in advance.

Oct 29 '06 #2

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

Similar topics

2
by: Sisnaz | last post by:
I'm working with 2005 Beta 2 and I'm sure this is a trivial question but for the life of me I can't figure out. I placed a menu navigation componet on my master page and defined the navigation...
0
by: Tommy | last post by:
I am working on a site that uses a menu control. Because I need more than one master page for different looks I put the common controls in webcontrols and use them in the master pages to maintain...
4
by: Bart | last post by:
Hi, I have a menu on my master page. When I click on a menu item the state is reset after the page is redirected to the NavigateURL. How can fix this? Thanks Bart
7
by: tfsmag | last post by:
Has anyone had a problem with putting a menu control into a master page in .net 2.0? I have a problem where if i just drop a menu control on a regular page the menu works fine, the submenus work...
3
by: Joao Batista | last post by:
Hi all, I have a MasterPage with a menu, populated from a database, my problem now is when i chose an option , how can i pass (catch) the value to my products page??? Thanks Joao Batista
6
by: Ben Fidge | last post by:
Hi I've just created a new Master Page for my site and it uses the native Menu control. Strange behaviour is happening on page that use the master page. For some reason, the menu controls...
4
by: iiman | last post by:
I have converted 1.1 application to 2.0 application. Now I am using master page with the menu controls provided by 2.0 framework. Problem is that when I hover over the menu, dynamic menu appears...
8
by: =?Utf-8?B?V2ViQnVpbGRlcjQ1MQ==?= | last post by:
I the page knows there was a cross post back. but i can not find the control. (asp.net 3.5) calling page has a master calling control: <asp:Button ID="btnSendAlert" runat="server" Text="Go"...
3
by: win | last post by:
I've create menu in a webform. <asp:Menu ID="Menu1" runat="server" CssClass="toolbar" Orientation="Horizontal"> <Items> <asp:MenuItem Text="Master" Value="Master"> <asp:MenuItem...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.