Anonymous user  |  Log in  |  Create Account


getGMapElementById... mmmhh, sounds good, right?

It works just like it sounds: it gets the Javascript ID of the elements that have been added to the map (normally markers), so that the limits are up to you ;)

It can be used by means of a static method of the GMap class, or as a method of your instance of the control.

Like always, this simple example is enlightening (click on the map and the icon):

<cc1:GMap ID="GMap1" runat="server" enableServerEvents="True" OnClick="GMap1_Click" OnMarkerClick="GMap1_MarkerClick" />
protected string GMap1_Click(object s, GAjaxServerEventArgs e)
    return new GMarker(e.point).ToString(;

protected string GMap1_MarkerClick(object s, GAjaxServerEventArgs e)
    string markerID = GMap1.getGMapElementById(e.who);

    string js = string.Format(@"
            if ({0}.getVisible())
            ", markerID);

    js += string.Format("alert('point: ' + {0}.getPosition());", markerID);

    return js;
Powered by Subgurim.NET