This project is read-only.

GoogleMap 2.8: Client side events handlers don't seem to work

Feb 18, 2008 at 3:24 AM
Hi all and especially to Velio (thx for your great work!),

I'm trying to use the OnClientClick functionality of the GoogleMap control and it worked wonderfully in release 2.7 as demonstrated in the "capture position sample"

Now I updated to 2.8 but now I can't get it back to work, i.e. my handler function doesn't get called when the client click event is fired. I can see that the event is fired because when I do sth. like this


it works. But when I assign my client javascript function

function clientShowPosition(overlay,position) {
alert("in the function");
if(position) {
alert("lat:" + + " lng:" + position.lng());
var el = document.getElementById('<%= tbLatitude.ClientID %>');
el.value =;
el = document.getElementById('<%= tbLongitude.ClientID %>');
el.value = position.lng();

like this: OnClientClick="clientShowPosition"

it does not get called :-( Do you have any clue why? Like I said, the same code worked back in 2.7, although I've seen that changes have been made right around there.

I tried the server side event handler and it worked, but there I have the problem that I don't know how to get the coordinates that were clicked...

Any help is greatly appreciated!

Good night,
Feb 18, 2008 at 9:10 AM
Try setting OnClientClick like this:

Feb 18, 2008 at 11:36 AM
Hi again,

thanks for your hint. Since I'm quite new to JavaScript, I unfortunately didn't try that way of assigning before. So I tried it - and it still didn't work! Well, hail Firebug: somehow it seems that the parameters of the handler function must be called EXACTLY the same way as they are in the GoogleMap.js, where it says

if( { handler = function(overlay, point) { eval(; }; ... }

So I did that - and finally it works :-)

How would the server side handler have to be defined to get that same information, i.e. overlay and point coordinates? Is the GoogleMap.js the right place to look for the handler signatures?

Well, thanks again for your help, last night I was really frustrated - now I feel much better ;-)

Have a good day,