I am setting up a ContextMenu on my Map and would like to fire off some client side code. I noticed that no event arguments are getting passed into my javascript functions. Also, my Maps OnClientClick function is getting raised as well as the ContextMenuItems OnClientClick function
Here is how I setup the context menu:
ContextMenu contextMenu = new ContextMenu("divContextMenu", 150);
ContextMenuItem contextMenuItem = new ContextMenuItem("Center Map Here");
contextMenuItem.OnClientClick = "CenterMapHere";
contextMenu.MenuItems.Add(contextMenuItem);
Map1.ContextMenu = contextMenu;
Here is my client function
function CenterMapHere(e) // e is undefined
{
// trying to grab point where user right clicked,
// without also raising Map1.OnClientClick event
var lonlat = this.getLonLatFromViewPortPx(e.xy);
var x = lonlat.lon;
var y = lonlat.lat;
Map1.SetCenter(x,y);
}