Detect click events outside div inside usercontrol

Posted by toraan on Stack Overflow See other posts from Stack Overflow or by toraan
Published on 2010-03-28T17:33:55Z Indexed on 2010/03/29 14:43 UTC
Read the original article Hit count: 280

Filed under:
|

I have a div inside a user control that is displayed by the user after some event.
I want to hide this div when user clicks anywhere elese on the page but not on the div (or not on any element that is inside the div).

If it wasn't a user control I could use body's clieck event to check the target, but because this is usercontrol that is hosted by other page I can't just "play" with it's elements.

How can I achieve that without using body of the hosting page?

© Stack Overflow or respective owner

Related posts about ASP.NET

Related posts about JavaScript