Created a simple ContextMenu for map and getting the following error :
body {font-family:"Verdana";font-weight:normal;font-size: .7em;color:black;}
p {font-family:"Verdana";font-weight:normal;color:black;margin-top: -5px}
b {font-family:"Verdana";font-weight:bold;color:black;margin-top: -5px}
H1 { font-family:"Verdana";font-weight:normal;font-size:18pt;color:red }
H2 { font-family:"Verdana";font-weight:normal;font-size:14pt;color:maroon }
pre {font-family:"Lucida Console";font-size: .9em}
.marker {font-weight: bold; color: black;text-decoration: none;}
.version {color: gray;}
.error {margin-bottom: 10px;}
.expandable { text-decoration:underline; font-weight:bold; color:navy; cursor:hand; }
Server Error in '/' Application.
Error binding to target method.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.ArgumentException: Error binding to target method.
Code below:
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
CreateContextMenu();
}
}
private void CreateContextMenu()
{
ContextMenu menuOnMap = new ContextMenu("MapMenu", 100);
ContextMenuItem panItem = new ContextMenuItem("Pan Map");
panItem.Click += new EventHandler<ContextMenuItemClickEventArgs>(panItem_Click);
menuOnMap.MenuItems.Add(panItem);
Map1.ContextMenu = menuOnMap;
}
void panItem_Click(object sender, ContextMenuItemClickEventArgs e)
{
//Debugger does not reach here before error occurs.
}
Any suggestions??
Thanks in advance,
Cruz