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 2521
1- In the content page you need to get a reference to the master page like
this:
<%@ MasterType virtualPath="~/MasterPage.master"%> http://msdn2.microsoft.com/en-us/library/c8y19k6h.aspx
2- Assuming that the master page raises and event (let's call it
MasterPageEvent1 that has a delegate named MyEventHandler) then you can wire
up an event handler in the content page like this:
Master.MasterPageEvent1+= new MyEventHandler(Master_MasterPageEvent1);
3- Write a function:
void Master_MasterPageEvent1(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.MasterPage
Event event1(ByVal sender As Object, ByVal e As EventArgs)
Protected Sub guardarImageButton_Click(ByVal sender As Object, ByVal e
As System.Web.UI.ImageClickEventArgs) Handles guardarImageButton.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.Page
Public Sub metodo()
End Sub
Protected Sub Page_Init(ByVal sender As Object, ByVal e As
System.EventArgs) 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.master"%>
http://msdn2.microsoft.com/en-us/library/c8y19k6h.aspx
2- Assuming that the master page raises and event (let's call it MasterPageEvent1 that has a delegate named MyEventHandler) then you can wire up an event handler in the content page like this:
Master.MasterPageEvent1+= new MyEventHandler(Master_MasterPageEvent1);
3- Write a function: void Master_MasterPageEvent1(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 MasterPageEventHandler1(sender As Object, e As
System.Web.UI.ImageClickEventArgs)
Partial Class MasterPage
Inherits System.Web.UI.MasterPage
Public Event1 As MasterPageEventHandler1
Protected Sub guardarImageButton_Click(ByVal sender As Object, ByVal e
As System.Web.UI.ImageClickEventArgs) Handles guardarImageButton.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.master"%>
--
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.MasterPage
Event event1(ByVal sender As Object, ByVal e As EventArgs)
Protected Sub guardarImageButton_Click(ByVal sender As Object, ByVal e As System.Web.UI.ImageClickEventArgs) Handles guardarImageButton.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.Page
Public Sub metodo()
End Sub
Protected Sub Page_Init(ByVal sender As Object, ByVal e As System.EventArgs) 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.master"%>
http://msdn2.microsoft.com/en-us/library/c8y19k6h.aspx
2- Assuming that the master page raises and event (let's call it MasterPageEvent1 that has a delegate named MyEventHandler) then you can wire up an event handler in the content page like this:
Master.MasterPageEvent1+= new MyEventHandler(Master_MasterPageEvent1);
3- Write a function: void Master_MasterPageEvent1(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 MasterPageEventHandler1(sender As Object, e As System.Web.UI.ImageClickEventArgs)
Partial Class MasterPage Inherits System.Web.UI.MasterPage
Public Event1 As MasterPageEventHandler1
Protected Sub guardarImageButton_Click(ByVal sender As Object, ByVal e As System.Web.UI.ImageClickEventArgs) Handles guardarImageButton.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.master"%>
-- 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.MasterPage
Event event1(ByVal sender As Object, ByVal e As EventArgs)
Protected Sub guardarImageButton_Click(ByVal sender As Object, ByVal e As System.Web.UI.ImageClickEventArgs) Handles guardarImageButton.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.Page
Public Sub metodo()
End Sub
Protected Sub Page_Init(ByVal sender As Object, ByVal e As System.EventArgs) 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.master"%>
http://msdn2.microsoft.com/en-us/library/c8y19k6h.aspx
2- Assuming that the master page raises and event (let's call it MasterPageEvent1 that has a delegate named MyEventHandler) then you can wire up an event handler in the content page like this:
Master.MasterPageEvent1+= new MyEventHandler(Master_MasterPageEvent1);
3- Write a function: void Master_MasterPageEvent1(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**********************************@microsof t.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 MasterPageEventHandler1(sender As Object, e As System.Web.UI.ImageClickEventArgs)
Partial Class MasterPage Inherits System.Web.UI.MasterPage
Public Event1 As MasterPageEventHandler1
Protected Sub guardarImageButton_Click(ByVal sender As Object, ByVal e As System.Web.UI.ImageClickEventArgs) Handles guardarImageButton.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.master"%>
-- 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.MasterPage
Event event1(ByVal sender As Object, ByVal e As EventArgs)
Protected Sub guardarImageButton_Click(ByVal sender As Object, ByVal e As System.Web.UI.ImageClickEventArgs) Handles guardarImageButton.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.Page
Public Sub metodo()
End Sub
Protected Sub Page_Init(ByVal sender As Object, ByVal e As System.EventArgs) 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.master"%> > > http://msdn2.microsoft.com/en-us/library/c8y19k6h.aspx > > 2- Assuming that the master page raises and event (let's call it > MasterPageEvent1 that has a delegate named MyEventHandler) then you can > wire > up an event handler in the content page like this: > > Master.MasterPageEvent1+= new MyEventHandler(Master_MasterPageEvent1); > > 3- Write a function: > void Master_MasterPageEvent1(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...
|
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...
|
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...
|
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...
|
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...
|
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...
|
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...
|
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...
|
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...
|
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...
|
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
|
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...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
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: 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...
|
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...
|
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...
|
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,...
| |