
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
ESRI.ArcGIS.ADF.Web.UI.WebControls.ContextMenuItem contextMenuItem =
new ESRI.ArcGIS.ADF.Web.UI.WebControls.ContextMenuItem();
contextMenuItem.Text = "Zoom In";
ContextMenu1.Items.Add(contextMenuItem);
}
}
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { ESRI.ArcGIS.ADF.Web.UI.WebControls.ContextMenuItem contextMenuItem = new ESRI.ArcGIS.ADF.Web.UI.WebControls.ContextMenuItem(); contextMenuItem.Text = "Zoom In"; ContextMenu1.Items.Add(contextMenuItem); string showContextMenu = string.Format("esriShowContextMenu(event,'{0}','{1}','{2}');return false;", ContextMenu1.ClientID, Map1.UniqueID, ""); Map1.Attributes.Add("oncontextmenu", showContextMenu); } }
protected void ContextMenu1_ItemClicked(object sender, ESRI.ArcGIS.ADF.Web.UI.WebControls.ContextMenuItemEventArgs contextMenuItemEventArgs)
{
switch (contextMenuItemEventArgs.Item.Text)
{
case "Zoom In":
{
Map1.Zoom(2);
ContextMenu1.CallbackResults.CopyFrom(Map1.CallbackResults);
break;
}
}
}

| Property Name | Type | Description |
|---|---|---|
| HoverBorderColor | Color | The color of the border around a context menu item when the mouse cursor hovers over it at runtime. |
| HoverColor | Color | The background color of the context menu item when the mouse cursor hovers over it at runtime. |
| Event Type | Description |
|---|---|
| ItemClicked | Occurs when a context menu item is clicked. |