473,507 Members | 12,744 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How can I read the events handlers of a UI object?

I posted this question a couple days ago on , but didn't get any
answers, so I will try here.

My issue: there is a link button with an event handler for a Click
event. I want to create another link button that will act exactly like
the first. So I want to set its Click event handler to be the same as
the first one. But I can't figure out how I can see what the first
one's event handler is.
thanks in advance.

Nov 19 '05 #1
4 996
Oh, you want to interogate a control to get everyone who's registered for
an event on said control? You can't, as the delegate is private inside of
the control. If it were public then it'd not be a problem. So you can either
derive your own that makes it public or use reflection to bypass the access
modifier.

-Brock
DevelopMentor
http://staff.develop.com/ballen
I posted this question a couple days ago on , but didn't get any
answers, so I will try here.

My issue: there is a link button with an event handler for a Click
event. I want to create another link button that will act exactly like
the first. So I want to set its Click event handler to be the same as
the first one. But I can't figure out how I can see what the first
one's event handler is.
thanks in advance.


Nov 19 '05 #2
John:

If you are using Visual Studio, select the link button and view the
properties window. Then select the button at the top of this window that
looks like a lightning bolt. That will show you the events for the link
button and what event handler is set for the Click event.

A second method is to examine the InitializeComponent method of the code
behind page. This will show code for adding the events for a particular
control on the page.

For example:

this.LinkButton1.Click += new System.EventHandler(this.Page_Load);

--
David Lloyd
MCSD .NET
http://LemingtonConsulting.com

This response is supplied "as is" without any representations or warranties.
<jo********@yahoo.com> wrote in message
news:11**********************@z14g2000cwz.googlegr oups.com...
I posted this question a couple days ago on , but didn't get any
answers, so I will try here.

My issue: there is a link button with an event handler for a Click
event. I want to create another link button that will act exactly like
the first. So I want to set its Click event handler to be the same as
the first one. But I can't figure out how I can see what the first
one's event handler is.
thanks in advance.

Nov 19 '05 #3
David,
Thanks for the reply. What I want is not to see the handlers at design
time, but to detect it at runtime. So I want to query the object while
the application is running to ask it what its event handlers are. But
it seems from the other response I got from
Brock Allen that it might not be possible because it's private.
John

Nov 19 '05 #4
I didn't say you couldn't do it (I don't think I said that). You'd need to
use reflection to do this.

-Brock
DevelopMentor
http://staff.develop.com/ballen
David,
Thanks for the reply. What I want is not to see the handlers at design
time, but to detect it at runtime. So I want to query the object while
the application is running to ask it what its event handlers are. But
it seems from the other response I got from
Brock Allen that it might not be possible because it's private.
John


Nov 19 '05 #5

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

Similar topics

6
3289
by: Thomas | last post by:
Hi, I'm having a problem with the dynamically created inputfields in Internet Explorer. The situation is the following: - I have a dynamically created table with a textbox in each Cell. - It...
3
2011
by: Sasha | last post by:
Hi everyone, Here is my problem: I have the following classes: - DataNode - this class is designed to hold some data and will be contained in a tree like data structure DataTree. When...
1
2271
by: Bruce M. Carroll | last post by:
I am doing some work a distributed application, which uses events and remoting to accomplish the signaling between applications. This all works. The problem I have (I think) is that since...
16
2872
by: anonymous.user0 | last post by:
The way I understand it, if I have an object Listener that has registered as a listener for some event Event that's produced by an object Emitter, as long as Emitter is still allocated Listener...
6
2250
by: Joseph Geretz | last post by:
Writing an Outlook AddIn with C#. For the user interface within Outlook I'm adding matching pairs of Toolbar buttons and Menu items. All of the buttons and menu items are wired up to send events to...
7
3431
by: sam.m.gardiner | last post by:
I'm working with VB.NET events and I want a way to disconnect all the handlers of an event. I want to do this in the object that is the source of the event. This is slightly tricky in VB.Net as the...
5
2746
by: Daniel | last post by:
Hey guys When you hook an event (c# 2.0 syntax): myEvent += MyMethodToFire; You need to also unsubscribe it to avoid a resource leak so that the object it is in gets garbage collected like so...
7
2315
by: mavigozler | last post by:
IE7 does not appear to set an event on contained text inside SPAN elements whose 'onclick', 'onmouseover', and 'onmouseout' events, defying the HTML recommendation. Firefox appears to conform. ...
11
3219
by: MikeT | last post by:
This may sound very elementary, but can you trap when your object is set to null within the object? I have created a class that registers an event from an object passed in the constructor. When...
15
6505
by: damiensawyer | last post by:
Hi, I am creating a class (from a base class) that needs to trigger events (code at bottom). I am instatiating the classes and wiring up the events as follows. clsDetermineConnection oDC =...
0
7221
marktang
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,...
0
7109
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
7313
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
7372
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...
1
7029
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
4702
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3190
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...
0
1537
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 ...
0
411
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.