getGMapElementById
getGMapElementById... mmm,
sounds good, no?
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 endless ;)
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):
Code.aspx
<cc1:GMap ID="GMap1" runat="server" enableServerEvents="True" OnClick="GMap1_Click" OnMarkerClick="GMap1_MarkerClick" />
Code.aspx.cs
protected string GMap1_Click(object s, GAjaxServerEventArgs e)
{
return new GMarker(e.point).ToString(e.map);
}
protected string GMap1_MarkerClick(object s, GAjaxServerEventArgs e)
{
string markerID = GMap1.getGMapElementById(e.who);
string js = string.Format(@"
if ({0}.isHidden())
{0}.show()
else
{0}.hide();
", markerID);
js += string.Format("alert('point: ' + {0}.getPoint() + ' - icon: ' + {0}.getIcon().image);", markerID);
return js;
}