Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > How can I read the events handlers of a UI object?

Reply
Thread Tools

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

 
 
johngilmer@yahoo.com
Guest
Posts: n/a
 
      05-05-2005
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.

 
Reply With Quote
 
 
 
 
Brock Allen
Guest
Posts: n/a
 
      05-05-2005
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.




 
Reply With Quote
 
 
 
 
David Lloyd
Guest
Posts: n/a
 
      05-05-2005
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.


<> wrote in message
news: 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.
>



 
Reply With Quote
 
johngilmer@yahoo.com
Guest
Posts: n/a
 
      05-12-2005
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

 
Reply With Quote
 
Brock Allen
Guest
Posts: n/a
 
      05-12-2005
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




 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Axis - Can handlers get access to provider objects? Paco Java 0 02-21-2006 09:56 PM
Mouse events, classes, handlers fuubaa Javascript 1 02-17-2006 05:55 PM
Binary data stored in SQL Server: can't read from ASP.NET, *can* read from Access? Doug ASP .Net 3 11-04-2005 07:35 PM
Events Events Events Please Help Chris ASP .Net Web Controls 0 08-30-2005 08:21 PM
How to create dynamic events handlers for Imagebuttons RA ASP .Net 2 12-11-2003 02:48 PM



Advertisments