Fog Creek Software
Discussion Board

Welcome! and rules

Joel on Software

ASP.NET/Postback from javascript

I have an ASP.NET image button (not just image, the image button which is input type=image) that has a postback associated with it. On certain areas of this button, I show a bordered DIV (sort of like highlighting a hotspot). The thing is, when the DIV becomes visible, that specific area does not capture a click. So I have an onClick event on the DIV - the problem is, I can't figure out how to postback on clicking it (I did try javascript:__dopostback(elementIDofImage," "); - is that the way? When the page does postback, I need the point of click on the image - which I could get in the image click method using .X, .Y. How do I achieve the same effect but posting via the DIV?

Any thoughts appreciated.

Friday, May 13, 2005

Lookup IPostBackEventHandler.  You implement this interface in the class that you want to receive the __dopostback result from.  The second arg of __dopostback is a string that you can fill with whatever parameters you'd like (mouse coords, whatever).

Friday, May 13, 2005

How about placing yet another image button with transparent gif/png within the div?

Monday, May 16, 2005

*  Recent Topics

*  Fog Creek Home