To be more specific...
My custom control is made up of two images and a div. A click on either of
the images or the div should trigger the click event.
> I created a custom control - inheriting from WebControl.
>
> How do I give this control a click event for the user of the control to put
> some code behind? Thanks.
>
> Jerry
Hi,
you'd need to implement IPostBackEventHandler interface, plus generate
script calls into onclick attributes of images and divs (is it div
containing two images? should it be distinct which one was clicked or just
the div is enough?)
You can make the script call with Page.GetPostBackEventReference (in ASP.NET
v2.0 it's Page.ClientScript.GetPostBackEventReference) and if you need to
distinguish between clicked elements, give that method an argument
indicvating which one was clicked.
When you implement IPostBackEventHandler interface, given argument is passed
there (e.g IPostBackEventHandler.RaisePostBackEvent is raised when the
element is clicked and postback script run) so you can raise your own event
from there.
Tell a bit more about the images and div, and I can give you a code sample.
Here's also a good stuff to look at
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpguide/html/cp
conReceivingPostbackEventNotifications.asp
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpguide/html/cp
congeneratingclient-sidejavascriptforpostback.asp

Signature
Teemu Keiski
ASP.NET MVP, AspInsider
Finland, EU
http://blogs.aspadvice.com/joteke
> To be more specific...
>
[quoted text clipped - 9 lines]
>>
>> Jerry
rlrcstr@newsgroups.nospam - 10 Feb 2006 20:30 GMT
Okay... I got it. I was missing the onclick handler on the client side.
Thanks.
> Hi,
>
[quoted text clipped - 33 lines]
> >>
> >> Jerry