473,569 Members | 2,845 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Event & Delegate Question

I have written a control in ASP.Net that needs to react if a specified method
gets fired.

In other words, I want the control to do some work if a method that acts as
the event handler for a button is executed via the button click event.

The developer will be able to assign any method with the same signature as a
button click event handler has to it. This will make the control do some work
whenever any of the button click event handlers execute.

Does anyone have any idea how to handle that? I hope what I'm asking makes
sense.

--
-Demetri
Jun 16 '06 #1
1 1113
V
Hello Demetri,

If your control has a method that needs to be fired whenever the
button_click occurs, all you need to be make sure is that the method
(that has to be fired) should be of the same EventHandler type as that
of a Button_Click.

Then you can simply register your method to the Button.Click event of
any button you want to connect to your control (in addition to the
button'd eventhandler of course).

Regards,
Vaibhav

Demetri wrote:
I have written a control in ASP.Net that needs to react if a specified method
gets fired.

In other words, I want the control to do some work if a method that acts as
the event handler for a button is executed via the button click event.

The developer will be able to assign any method with the same signature as a
button click event handler has to it. This will make the control do some work
whenever any of the button click event handlers execute.

Does anyone have any idea how to handle that? I hope what I'm asking makes
sense.

--
-Demetri


Jun 16 '06 #2

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

Similar topics

1
2532
by: emma middlebrook | last post by:
Hi I want to find out what objects are due to receive an event i.e. those that have added themselves as an event handler via +=. Yes, it's a little pointless perhaps (or can anyone give some good uses for this?!!). How do I do this for an event on a class I implement? Also, how may I do this for an event in the .Net framework e.g. a...
7
1785
by: Brian Keating | last post by:
hi there this may seem like a silly question but what exactly is the difference ... ok .. that question is probably a bit ambiguous.. i know what delegates are i know what events are, i use them everyday but.. what are events needed? don't delegates do everything? look at this code normally i would use an event but i've just stuck with...
5
3008
by: Mike Labosh | last post by:
In VB 6, the Form_QueryUnload event had an UnloadMode parameter that let me find out *why* a form is unloading, and then conditionally cancel the event. In VB.NET, the Closing event passes a CancelEventArgs that lets me cancel the Close() operation, but is there still any way to find out *why* a form is closing? This app as a form that...
20
2371
by: Bob Day | last post by:
Using VS 2003, VB, MSDE... There are two threads, A & B, that continously run and are started by Sub Main. They instantiationsl of identical code. Thread A handles call activity on telephone line 1 and Thread B handles call activity on telephone line 2. They use a common SQL datasource, but all DataSets are unique to each thread. Is...
13
3489
by: Charles Law | last post by:
Mr "yEaH rIgHt" posted the following link about a week ago in answer to my question about removing event handlers. > http://www.vbinfozine.com/t_bindevt.shtml Following on from that post, the following issues still exist. The article shows how to find methods on a receiver that match the pattern OnXXXX given the sender. It loops through...
4
2112
by: Peter Oliphant | last post by:
I've upgraded my code to VS C++.NET 2005 (Express) using /clr pure. My question is, why is there an exception to the rule in how pointer syntax is done in the event handlers? For example, why is this proper syntax: button->Click += gcnew EventHandler( this, &MyClass::MouseHandler ) ; The '&' seems like a hold over from the old syntax,...
1
1613
by: Scott M. | last post by:
I'm trying to get my head around what's involved in C# to declare, raise and respond to an event. I'm coming from the VB.NET world where to declare and event we wrote: Public Event Foo() To raise the event, we wrote: RaiseEvent Foo()
3
1055
by: Curious | last post by:
Hi, I have a program that gets the prices of stocks in real-time. The program consists of the following key components: // Constructor public GetRealTimeStockPrice() { // Step 1
24
55097
by: =?Utf-8?B?U3dhcHB5?= | last post by:
Can anyone suggest me to pass more parameters other than two parameter for events like the following? Event: Onbutton_click(object sender, EventArgs e)" Event handler: button.Click += new EventHandler(Onbutton_click); I want to pass more information related that event. & want to use that
4
237
by: tshad | last post by:
I am just getting started with events and had a couple of questions on why they do what they do. If you have a textbox and you want to handle an event you can just do: this.TextBox2.TextChanged += new EventHandler(TextBox2_TextChanged); and then have the function. void TextBox2_TextChanged(object sender, EventArgs e)
0
7612
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7922
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, 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. ...
0
8119
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7668
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...
0
6281
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
0
3653
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...
0
3637
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2111
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
1
1209
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.