I have a problem, I have an event declared in a Master Page, and I want to
use in a Content Page holder of a Content Page. When I want to create the
method to handle the event, I can njot reference the Master Page event, in
its place IntelliSense shows me a Delegate Sub EventHandler. I am new with
events managements, so any help and guiadance will be appreciated.
Federico 5 2566
1- In the content page you need to get a reference to the master page like
this:
<%@ MasterType virtualPath="~/MasterPage.mast er"%> http://msdn2.microsoft.com/en-us/library/c8y19k6h.aspx
2- Assuming that the master page raises and event (let's call it
MasterPageEvent 1 that has a delegate named MyEventHandler) then you can wire
up an event handler in the content page like this:
Master.MasterPa geEvent1+= new MyEventHandler( Master_MasterPa geEvent1);
3- Write a function:
void Master_MasterPa geEvent1(object sender, EventArgs e)
{
//steps within handling the event
}
For more detail on raising and consuming events: http://msdn2.microsoft.com/en-us/library/9aackb16.aspx
--
HTH,
Phillip Williams http://www.societopia.net http://www.webswapp.com
"Federico" wrote: I have a problem, I have an event declared in a Master Page, and I want to use in a Content Page holder of a Content Page. When I want to create the method to handle the event, I can njot reference the Master Page event, in its place IntelliSense shows me a Delegate Sub EventHandler. I am new with events managements, so any help and guiadance will be appreciated.
Federico
I´m developing using VB 2005, I can not view the public event declarated in
the master page, from the content page, so i'm unable to wire up the event
with the handler.
Here is the source code from MasterPage
Partial Class MasterPage
Inherits System.Web.UI.M asterPage
Event event1(ByVal sender As Object, ByVal e As EventArgs)
Protected Sub guardarImageBut ton_Click(ByVal sender As Object, ByVal e
As System.Web.UI.I mageClickEventA rgs) Handles guardarImageBut ton.Click
RaiseEvent event1(Me, e)
End Sub
End Class
Public Delegate Sub ManejadorEvento (ByVal sender As Object, ByVal e As
EventArgs)
.....and here the code of content page
artial Class _Default
Inherits System.Web.UI.P age
Public Sub metodo()
End Sub
Protected Sub Page_Init(ByVal sender As Object, ByVal e As
System.EventArg s) Handles Me.Init
AddHandler Master.event1, AddressOf metodo ' this is the wrong line
End Sub
End Class
The error reported is:"'event1' is not an event of 'System.Web.UI. MasterPage'.
Please give me an example in VB 2005
Thanks
"Phillip Williams" wrote: 1- In the content page you need to get a reference to the master page like this: <%@ MasterType virtualPath="~/MasterPage.mast er"%>
http://msdn2.microsoft.com/en-us/library/c8y19k6h.aspx
2- Assuming that the master page raises and event (let's call it MasterPageEvent 1 that has a delegate named MyEventHandler) then you can wire up an event handler in the content page like this:
Master.MasterPa geEvent1+= new MyEventHandler( Master_MasterPa geEvent1);
3- Write a function: void Master_MasterPa geEvent1(object sender, EventArgs e) { //steps within handling the event } For more detail on raising and consuming events: http://msdn2.microsoft.com/en-us/library/9aackb16.aspx
-- HTH, Phillip Williams http://www.societopia.net http://www.webswapp.com
"Federico" wrote:
I have a problem, I have an event declared in a Master Page, and I want to use in a Content Page holder of a Content Page. When I want to create the method to handle the event, I can njot reference the Master Page event, in its place IntelliSense shows me a Delegate Sub EventHandler. I am new with events managements, so any help and guiadance will be appreciated.
Federico
The link I posted previously has an example in VB that can guide you: http://msdn2.microsoft.com/en-us/library/9aackb16.aspx
Briefly you needed to modify your code to look like this:
Public Delegate Sub MasterPageEvent Handler1(sender As Object, e As
System.Web.UI.I mageClickEventA rgs)
Partial Class MasterPage
Inherits System.Web.UI.M asterPage
Public Event1 As MasterPageEvent Handler1
Protected Sub guardarImageBut ton_Click(ByVal sender As Object, ByVal e
As System.Web.UI.I mageClickEventA rgs) Handles guardarImageBut ton.Click
RaiseEvent event1(Me, e)
End Sub
End Class
Then In the content page you need to get a reference to the master page like
this:
<%@ MasterType virtualPath="~/MasterPage.mast er"%>
--
HTH,
Phillip Williams http://www.societopia.net http://www.webswapp.com
"Federico" wrote: I´m developing using VB 2005, I can not view the public event declarated in the master page, from the content page, so i'm unable to wire up the event with the handler. Here is the source code from MasterPage
Partial Class MasterPage Inherits System.Web.UI.M asterPage
Event event1(ByVal sender As Object, ByVal e As EventArgs)
Protected Sub guardarImageBut ton_Click(ByVal sender As Object, ByVal e As System.Web.UI.I mageClickEventA rgs) Handles guardarImageBut ton.Click RaiseEvent event1(Me, e) End Sub
End Class
Public Delegate Sub ManejadorEvento (ByVal sender As Object, ByVal e As EventArgs)
....and here the code of content page
artial Class _Default Inherits System.Web.UI.P age
Public Sub metodo()
End Sub
Protected Sub Page_Init(ByVal sender As Object, ByVal e As System.EventArg s) Handles Me.Init AddHandler Master.event1, AddressOf metodo ' this is the wrong line End Sub End Class
The error reported is:"'event1' is not an event of 'System.Web.UI. MasterPage'.
Please give me an example in VB 2005
Thanks "Phillip Williams" wrote:
1- In the content page you need to get a reference to the master page like this: <%@ MasterType virtualPath="~/MasterPage.mast er"%>
http://msdn2.microsoft.com/en-us/library/c8y19k6h.aspx
2- Assuming that the master page raises and event (let's call it MasterPageEvent 1 that has a delegate named MyEventHandler) then you can wire up an event handler in the content page like this:
Master.MasterPa geEvent1+= new MyEventHandler( Master_MasterPa geEvent1);
3- Write a function: void Master_MasterPa geEvent1(object sender, EventArgs e) { //steps within handling the event } For more detail on raising and consuming events: http://msdn2.microsoft.com/en-us/library/9aackb16.aspx
-- HTH, Phillip Williams http://www.societopia.net http://www.webswapp.com
"Federico" wrote:
I have a problem, I have an event declared in a Master Page, and I want to use in a Content Page holder of a Content Page. When I want to create the method to handle the event, I can njot reference the Master Page event, in its place IntelliSense shows me a Delegate Sub EventHandler. I am new with events managements, so any help and guiadance will be appreciated.
Federico
Phillip thank you for your help. Now it works.
"Phillip Williams" wrote: The link I posted previously has an example in VB that can guide you: http://msdn2.microsoft.com/en-us/library/9aackb16.aspx
Briefly you needed to modify your code to look like this:
Public Delegate Sub MasterPageEvent Handler1(sender As Object, e As System.Web.UI.I mageClickEventA rgs)
Partial Class MasterPage Inherits System.Web.UI.M asterPage
Public Event1 As MasterPageEvent Handler1
Protected Sub guardarImageBut ton_Click(ByVal sender As Object, ByVal e As System.Web.UI.I mageClickEventA rgs) Handles guardarImageBut ton.Click RaiseEvent event1(Me, e) End Sub
End Class
Then In the content page you need to get a reference to the master page like this: <%@ MasterType virtualPath="~/MasterPage.mast er"%>
-- HTH, Phillip Williams http://www.societopia.net http://www.webswapp.com
"Federico" wrote:
I´m developing using VB 2005, I can not view the public event declarated in the master page, from the content page, so i'm unable to wire up the event with the handler. Here is the source code from MasterPage
Partial Class MasterPage Inherits System.Web.UI.M asterPage
Event event1(ByVal sender As Object, ByVal e As EventArgs)
Protected Sub guardarImageBut ton_Click(ByVal sender As Object, ByVal e As System.Web.UI.I mageClickEventA rgs) Handles guardarImageBut ton.Click RaiseEvent event1(Me, e) End Sub
End Class
Public Delegate Sub ManejadorEvento (ByVal sender As Object, ByVal e As EventArgs)
....and here the code of content page
artial Class _Default Inherits System.Web.UI.P age
Public Sub metodo()
End Sub
Protected Sub Page_Init(ByVal sender As Object, ByVal e As System.EventArg s) Handles Me.Init AddHandler Master.event1, AddressOf metodo ' this is the wrong line End Sub End Class
The error reported is:"'event1' is not an event of 'System.Web.UI. MasterPage'.
Please give me an example in VB 2005
Thanks "Phillip Williams" wrote:
1- In the content page you need to get a reference to the master page like this: <%@ MasterType virtualPath="~/MasterPage.mast er"%>
http://msdn2.microsoft.com/en-us/library/c8y19k6h.aspx
2- Assuming that the master page raises and event (let's call it MasterPageEvent 1 that has a delegate named MyEventHandler) then you can wire up an event handler in the content page like this:
Master.MasterPa geEvent1+= new MyEventHandler( Master_MasterPa geEvent1);
3- Write a function: void Master_MasterPa geEvent1(object sender, EventArgs e) { //steps within handling the event } For more detail on raising and consuming events: http://msdn2.microsoft.com/en-us/library/9aackb16.aspx
-- HTH, Phillip Williams http://www.societopia.net http://www.webswapp.com
"Federico" wrote:
> I have a problem, I have an event declared in a Master Page, and I want to > use in a Content Page holder of a Content Page. When I want to create the > method to handle the event, I can njot reference the Master Page event, in > its place IntelliSense shows me a Delegate Sub EventHandler. I am new with > events managements, so any help and guiadance will be appreciated. > > Federico
Great help Phillip!!
I was within the same error!!
See ya!@!
"Phillip Williams" <Ph************ **@webswapp.com > escreveu na mensagem
news:1D******** *************** ***********@mic rosoft.com... The link I posted previously has an example in VB that can guide you: http://msdn2.microsoft.com/en-us/library/9aackb16.aspx
Briefly you needed to modify your code to look like this:
Public Delegate Sub MasterPageEvent Handler1(sender As Object, e As System.Web.UI.I mageClickEventA rgs)
Partial Class MasterPage Inherits System.Web.UI.M asterPage
Public Event1 As MasterPageEvent Handler1
Protected Sub guardarImageBut ton_Click(ByVal sender As Object, ByVal e As System.Web.UI.I mageClickEventA rgs) Handles guardarImageBut ton.Click RaiseEvent event1(Me, e) End Sub
End Class
Then In the content page you need to get a reference to the master page like this: <%@ MasterType virtualPath="~/MasterPage.mast er"%>
-- HTH, Phillip Williams http://www.societopia.net http://www.webswapp.com
"Federico" wrote:
I´m developing using VB 2005, I can not view the public event declarated in the master page, from the content page, so i'm unable to wire up the event with the handler. Here is the source code from MasterPage
Partial Class MasterPage Inherits System.Web.UI.M asterPage
Event event1(ByVal sender As Object, ByVal e As EventArgs)
Protected Sub guardarImageBut ton_Click(ByVal sender As Object, ByVal e As System.Web.UI.I mageClickEventA rgs) Handles guardarImageBut ton.Click RaiseEvent event1(Me, e) End Sub
End Class
Public Delegate Sub ManejadorEvento (ByVal sender As Object, ByVal e As EventArgs)
....and here the code of content page
artial Class _Default Inherits System.Web.UI.P age
Public Sub metodo()
End Sub
Protected Sub Page_Init(ByVal sender As Object, ByVal e As System.EventArg s) Handles Me.Init AddHandler Master.event1, AddressOf metodo ' this is the wrong line End Sub End Class
The error reported is:"'event1' is not an event of 'System.Web.UI. MasterPage'.
Please give me an example in VB 2005
Thanks "Phillip Williams" wrote:
> 1- In the content page you need to get a reference to the master page > like > this: > <%@ MasterType virtualPath="~/MasterPage.mast er"%> > > http://msdn2.microsoft.com/en-us/library/c8y19k6h.aspx > > 2- Assuming that the master page raises and event (let's call it > MasterPageEvent 1 that has a delegate named MyEventHandler) then you can > wire > up an event handler in the content page like this: > > Master.MasterPa geEvent1+= new MyEventHandler( Master_MasterPa geEvent1); > > 3- Write a function: > void Master_MasterPa geEvent1(object sender, EventArgs e) > { > //steps within handling the event > } > For more detail on raising and consuming events: > http://msdn2.microsoft.com/en-us/library/9aackb16.aspx > > > -- > HTH, > Phillip Williams > http://www.societopia.net > http://www.webswapp.com > > > "Federico" wrote: > > > I have a problem, I have an event declared in a Master Page, and I > > want to > > use in a Content Page holder of a Content Page. When I want to create > > the > > method to handle the event, I can njot reference the Master Page > > event, in > > its place IntelliSense shows me a Delegate Sub EventHandler. I am new > > with > > events managements, so any help and guiadance will be appreciated. > > > > Federico This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Eric Newton |
last post by:
VB's more declarative nature of handling events is golden. I'm hoping C#
will acquire this type of deal, in addition to the anonymous delegates.
could do same as vb (actually would be easier to parse then vb due to
braces) whereas you look for Handles keyword after method sig, but before
opening brace of the method.
compiler would implicitly build event handling code for all typed
constructions, ie, any variables instances constructed...
|
by: Jorge Ayala |
last post by:
Well I'm trying to catch and act upon a button event that is placed within
the item template of a repeater control. Yet the code I'm using isn't
working. What I've seen out there to explain how to do this is way
complicated and assumes a familiarity with dot net that I don't have yet.
I'll get it eventually but this is where I'll get it. Here's my code.
First part is the user control and second is the code behind page
Use control
|
by: Michael Herman \(Parallelspace\) |
last post by:
1. What are some compelling solutions for using Master/Content pages with
Web Pages?
2. If a content area has a web part zone with web parts, what is the user
experience like when "editting" the web part page? Does it take place at
the page level? ...or the content area level?
3. Where is the Web Part Manager instantiated? ...in the Master Page?
....Content Page? ...elsewhere?
|
by: scsharma |
last post by:
Hi,
I am working on creating a webapplication and my design calls for creating
main webform which will have menu bar on left hand side and a IFrame which
will contain all the forms that are shown when menu items are clicked.Besides
these i would like to put a custom status bar. Any error message encountered
in any of the webpage will be displayed in the banner.
The problem iam encountering is how to access the customer status bar in
child...
|
by: dezza |
last post by:
Hi,
I am developing a web application that is a series of pages, rather like a
wizard.
Because all of the pages basically have the same navigation, and require the
navigation buttons in the same part of every screen, I have put the
navigation buttons on the Master Page.
The Content Pages, when they load, are able to change the caption of the
navigation buttons as required by accessing the properties of the Master Page.
| |
by: Apu Nahasapeemapetilon |
last post by:
Hello and thank you in advance for your help.
Can anyone think of a reason why this code would work properly on one PC,
but not another?
I've got a System.Windows.Forms.UserControl that products events which I
want to consume (sink) within Internet Explorer.
I'm following the instructions at:
ms-http://support.microsoft.com/default.aspx?kbid=313891.
|
by: LilC |
last post by:
I'm creating an application that has a standard layout for all pages.
The information that is displayed in the layout will be dynamic based
on the user that is logged in. Thus when a page is browsed to, I need
to check to see if the user has logged in or not. Then if they have
logged in, I need to pull their information from the database to
display in the header.
In previous applications, I made use of a base web page that all the...
|
by: Steve Hershoff |
last post by:
Hi everyone,
I've got a strange one here. There are two datagrids on my page, one nested
within the other. I'll refer to them as the topmost and secondary
datagrids.
In the topmost datagrid's OnItemDataBound() method we check for the row in
which it's appropriate to add the secondary datagrid. Exactly one row in
the topmost grid will contain the secondary grid.
|
by: richard.haber |
last post by:
I have a situation where there are two controls on the master page: a
tree with a menu structure (whose content and structure is customizable
by each user) and a menu control which displays the structure in a more
styled form.
The menu needs to get data from the tree in order to initialize
properly and can do so only after the tree has been initialized so that
its data is available. I can do this on a regular ASP.NET form since I
can...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
| |
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |