ASP.NET Syntax ASP.NET Syntax for Web Controls
Creates a control that displays an image on a page. When a hot spot region that is defined within the ImageMap control is clicked, the control either generates a postback to the server or navigates to a specified URL.
Declarative Syntax
<asp:ImageMap
AccessKey = "string"
AlternateText = "string"
BackColor = "color name | #dddddd"
BorderColor = "color name | #dddddd"
BorderStyle = "NotSet | None | Dotted | Dashed | Solid | Double | Groove |
Ridge | Inset | Outset"
BorderWidth = size
CssClass = "string"
DescriptionUrl = "uri"
Enabled = "True | False"
EnableTheming = "True | False"
EnableViewState = "True | False"
ForeColor = "color name | #dddddd"
GenerateEmptyAlternateText = "True | False"
Height = size
HotSpotMode = "NotSet | Navigate | PostBack | Inactive"
ID = "string"
ImageAlign = "NotSet | Left | Right | Baseline | Top | Middle | Bottom |
AbsBottom | AbsMiddle | TextTop"
ImageUrl = "uri"
OnClick = "Click event handler"
OnDataBinding = "DataBinding event handler"
OnDisposed = "Disposed event handler"
OnInit = "Init event handler"
OnLoad = "Load event handler"
OnPreRender = "PreRender event handler"
OnUnload = "Unload event handler"
runat = "server"
SkinID = "string"
Style = "string"
TabIndex = integer
Target = "string"
ToolTip = "string"
Visible = "True | False"
Width = size
>
<asp:CircleHotSpot
AccessKey = "string"
AlternateText = "string"
HotSpotMode = "NotSet | Navigate | PostBack | Inactive"
NavigateUrl = "uri"
PostBackValue = "string"
Radius = integer
TabIndex = integer
Target = "string | _blank | _parent | _search | _self | _top"
X = integer
Y = integer
/>
<asp:PolygonHotSpot
AccessKey = "string"
AlternateText = "string"
Coordinates = "string"
HotSpotMode = "NotSet | Navigate | PostBack | Inactive"
NavigateUrl = "uri"
PostBackValue = "string"
TabIndex = integer
Target = "string | _blank | _parent | _search | _self | _top"
/>
<asp:RectangleHotSpot
AccessKey = "string"
AlternateText = "string"
Bottom = integer
HotSpotMode = "NotSet | Navigate | PostBack | Inactive"
Left = integer
NavigateUrl = "uri"
PostBackValue = "string"
Right = integer
TabIndex = integer
Target = "string | _blank | _parent | _search | _self | _top"
Top = integer
/>
</asp:ImageMap>
For information on the individual members of this class, see ImageMap in the class library.
The ImageMap control renders an image that can contain custom-defined hot spot regions. When a user clicks a hot spot region, the control can either generate a postback to the server or navigate to a specified URL.
If you only need to capture the coordinates where the user clicked, and do not require the hot spot capabilities, the Image control can be a serviceable alternative.
The following example demonstrates how to create an ImageMap control declaratively that contains RectangleHotSpot and CircleHotSpot objects. The HotSpot property is set to HotSpotMode.Navigate, which causes the page to navigate to the specified URL each time a user clicks one of the hot spot regions.
<asp:imagemap id="solarsys"
imageurl = "~/abkd/shared/images/solarsys.gif"
width=504 height=126
alternatetext = "Solar System"
runat="Server">
<asp:rectanglehotspot
alternatetext = "Sun"
left=0 top=0 right=76 bottom=122
hotspotmode = "Navigate"
navigateurl = "/asp.net.ph/shared/images/sun.gif"
target = "_blank" />
<asp:circlehotspot
navigateurl = "/asp.net.ph/shared/images/mercury.gif"
x=90 y=61 radius=15
hotspotmode = "Navigate"
alternatetext = "Mercury"
target = "_blank" />
<asp:circlehotspot
navigateurl = "/asp.net.ph/shared/images/venus.gif"
x=124 y=61 radius=18
hotspotmode = "Navigate"
alternatetext = "Venus"
target = "_blank" />
... other hot spot definitions here ...
</asp:imagemap>
Show me
ImageMap Class ImageMap Web Server Control