I have a leaflet map that puts a marker where the mouse clicks:
javascript:
map.on('click', onMapClick); // event fired when user clicks the mouse
function onMapClick(e)
{
L.marker(e.latlng, { icon: myIcon }).addTo(map);
}
I want to select from a radiobutton list the number of markers to add at specified locations;
codebehind:
Point docMapCoordinate = new Point(90, 187);
string Script = String.Format("onMapClick('{0}');", docMapCoordinate.ToString());
this.Page.ClientScript.RegisterStartupScript(this.GetType(), "click", Script, true);
Part of my problem too is the Point to latlng for the leaflet mouse click event, but I've also tried to get a simply alert up like this:
this.Page.ClientScript.RegisterStartupScript(this.GetType(), "click", "alert('Does this work?');", true);
What is wrong in my attempt to call RegisterStartupScript
with Script
and any hints on the Point to LatLng conversion?