System.Web 2.0.0.0 System.Web.UI.WebControls.Image System.Web.UI.IPostBackEventHandler System.ComponentModel.DefaultEvent("Click") System.ComponentModel.DefaultProperty("HotSpots") System.Web.UI.ParseChildren(true, "HotSpots") In this topic: Introduction Accessibility Declarative Syntax

Introduction

Use the control to create an image that contains 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. For example, you can use this control to display a map of a geographical region. When a user clicks a specific region on the map, the control navigates to a URL that provides additional data about the selected region. You can also use this control to generate a postback to the server and run specific code based on the hot spot region that was clicked. For example, you can use an control to capture user responses such as votes. When a user clicks the hot spot region defined for yes votes, code is called to record a yes response in a database. When a user clicks on the hot spot region defined for no votes, a no response is recorded. You can also mix these two scenarios within a single control. For example, you can specify one hot spot region to navigate to a URL and another hot spot region to post back to the server. Use the property to specify the path to the image to display for the control. You can define any number of objects within an control. You can use the , , and classes to define hot spot regions. Alternatively, you can derive from the abstract class to define your own custom hot spot object. There are two ways to specify the behavior of a object in an control when the is clicked. You can use either the property on the control or the property on an individual object. These properties are set using one of the enumeration values. If both properties are set, the property specified on each individual object takes precedence over the property on the control. To navigate to a URL, set either the property or the property to HotSpotMode.Navigate. Use the property to specify the URL to navigate to. To generate a postback to the server, set either the property or the property to HotSpotMode.Postback. Use the property to specify a name for the hot spot region. This name will be passed in the event data when a postback event occurs. When a postback is clicked, the event is raised. To programmatically control the actions performed when a postback is clicked, provide an event handler for the event. To cause all objects in an control to have the same behavior, use the property to specify the behavior. Then, either set the property on each individual object to HotSpotMode.NotSet or do not specify a value for the property. To specify different behaviors for objects in an , set the property on each individual object to either HotSpotMode.Navigate or HotSpotMode.PostBack. If an control's property or the property on any of the objects it contains is set to HotSpotMode.NotSet or is not set to a value, by default the behavior is HotSpotMode.Navigate.

Accessibility

For information about how to configure this control so that it generates markup that conforms to accessibility standards, see
Accessibility in Visual Studio 2010 and ASP.NET 4 and ASP.NET Controls and Accessibility.

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"     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>
Creates a control that displays an image on a page. When a hot spot region defined within the control is clicked, the control either generates a postback to the server or navigates to a specified URL.
Constructor Use this constructor to initialize a new instance of the class. Initializes a new instance of the class. 2.0.0.0 Method System.Void This method is used primarily by control developers to insert the appropriate attributes and styles to the output stream for an control. This method overrides . Adds the HTML attributes and styles of an control to be rendered to the specified . A that represents the output stream to render HTML content on the client. 2.0.0.0 Event System.ComponentModel.Category("Action") System.Web.UI.WebControls.ImageMapEventHandler The event is raised when a object in an control is clicked. To allow a to raise the event, you must first set either the property on the control or the property on the object to HotSpotMode.Postback. To programmatically control the actions performed when a postback is clicked, provide an event handler for the event that contains the code to run when the event is raised. Raising an event invokes the event handler through a delegate. For more information about handling events, see Consuming Events. Occurs when a object in an control is clicked. 2.0.0.0 Property System.ComponentModel.DefaultValue(System.Web.UI.WebControls.HotSpotMode.NotSet) System.Web.UI.WebControls.HotSpotMode To be added. Use the property to specify the default click behavior of the objects within an control. This property is set using one of the enumeration values. The following table lists the possible values. Item Description Inactive The object does not have any behavior. NotSet The object uses the behavior set by the control's property. If the control does not define the behavior, the objects all navigate to a URL. Navigate The objects navigate to a URL. PostBack The objects generate a postback to the server. You can specify a object's behavior using either the property of the control or the property of each individual object. If both properties are set, the property specified on each individual object takes precedence over the property on the control. When you set the property of the control, note that the HotSpotMode.NotSet and HotSpotMode.Navigate values have the same behavior: both navigate to a URL. When you specify HotSpotMode.NotSet for the property of an individual object, that determines its behavior from the value of the property of the control. If you specify HotSpotMode.Navigate for the property, the page navigates to a URL when the is clicked. Use the property to specify the URL to navigate to. If you specify HotSpotMode.PostBack for the property, the page generates a postback to the server when the is clicked. Use the property to specify the name of the hot spot region. This name will be passed in the event data when a postback event occurs. When a postback is clicked, the event is raised. To programmatically control the actions performed when a postback is clicked, provide an event handler for the event. If you specify HotSpotMode.Inactive for the property, the object does not have any behavior when it is clicked. You can use this value to create an inactive hot spot within a larger active hot spot. This option is provided to allow you to create more complex hot spot zones within an control. To create an inactive area within an active hot spot, you must specify the inactive hot spot before the active hot spot in the control. For example, the following defines an active ring by specifying an inactive circular hot spot within a larger active circular hot spot: <asp:ImageMap ID="SaturnImage" ImageUrl="~/saturn.PNG" runat="server" OnClick="SaturnImage_Click"> <asp:CircleHotSpot AlternateText="planet" HotSpotMode=PostBack PostBackValue="planet" Radius=40 X=100 Y=100 /> <asp:CircleHotSpot HotSpotMode=Inactive Radius=60 X=100 Y=100 /> <asp:CircleHotSpot AlternateText="rings" HotSpotMode=PostBack PostBackValue="rings" Radius=80 X=100 Y=100 /> </asp:ImageMap> To cause all objects in an control to have the same behavior, use the property on the control to specify the behavior. Then, either set the property on each individual object to HotSpotMode.NotSet or do not specify a value for the property. To specify different behaviors for objects in an control, set the property on each individual object to either HotSpotMode.Navigate, HotSpotMode.PostBack, or HotSpotMode.Inactive. If an control's property or the property on any of the objects it contains is either set to HotSpotMode.NotSet or not set to a value, by default the behavior is HotSpotMode.Navigate. Gets or sets the default behavior for the objects of an control when the objects are clicked. 2.0.0.0 Property System.ComponentModel.DesignerSerializationVisibility(System.ComponentModel.DesignerSerializationVisibility.Content) System.Web.UI.PersistenceMode(System.Web.UI.PersistenceMode.InnerDefaultProperty) System.ComponentModel.NotifyParentProperty(true) System.Web.UI.WebControls.HotSpotCollection To be added. Use the property to programmatically manage the hot spot regions in an control. You can use the property to add, insert, remove, and retrieve objects. For more information, see . Gets a collection of objects that represents the defined hot spot regions in an control. 2.0.0.0 Method System.Void This method is used primarily by the .NET Framework infrastructure and is not intended to be used directly from your code. However, control developers can override this method to specify how a custom server control restores its view state. For more information, see ASP.NET State Management Overview. Restores view-state information for the control from a previous page request that was saved by the method. An that represents the control to restore. 2.0.0.0 Method System.Void The event is raised when a object in an control is clicked. To allow a to raise the event, you must first set either the property on the control or the property on the object to HotSpotMode.Postback. Raising an event invokes the event handler through a delegate. For more information, see Raising an Event. The method also allows derived classes to handle the event without attaching a delegate. This is the preferred technique for handling the event in a derived class. Raises the event for the control. An argument of type that contains the event data. 2.0.0.0 Method System.Void The page passes the value of the parameter to the method of the control. The raises a event for the object that was clicked. Raises events for the control when a form is posted back to the server. The argument for the event. 2.0.0.0 Method 2.0.0.0 System.Void This method is used primarily by control developers. When developing a custom server control derived from the control, you can override this method to generate content for the . Sends the control content to the specified object, which writes the content to render on the client. The object that receives the control content. Method System.Object This method is used primarily by control developers. View state is the accumulation of the values of a server control's properties. These values are automatically placed in the server control's property, which is an instance of the class. This property's value is then persisted to a string object after the save state stage of the server control life cycle. For more information, see ASP.NET State Management Overview. When view state is saved, this string object is returned to the client as a variable that is stored in an Hidden HTML element. When you author custom server controls, you can improve efficiency by overriding this method and modifying your server control's ViewState property. For more information, see ASP.NET State Management Overview. Saves any changes to an control's view-state that have occurred since the time the page was posted back to the server. Returns the control's current view state. If there is no view state associated with the control, this method returns null. 2.0.0.0 Property System.ComponentModel.DefaultValue("") System.String To be added. Use the property to specify the frame or window that displays the Web page r when the control is clicked. The Web page is specified by setting the property. The property is used when the value of the property is HotSpotMode.Navigate; it is ignored when the value of the property is HotSpotMode.PostBack. If the property is not set, the browser or window with focus refreshes when the control is clicked. The property renders as a target attribute. The target attribute on anchor elements is not allowed in the XHTML 1.1 document type definition. Do not set the property if the rendered output for the must be XHTML 1.1-compliant. For more information, see ASP.NET and XHTML Compliance. When creating accessible Web pages, it is strongly recommended that you avoid using the property to target another window. For more information, see Accessibility in Visual Studio 2010 and ASP.NET 4 and ASP.NET Controls and Accessibility. Gets or sets the target window or frame that displays the Web page content linked to when the control is clicked. 2.0.0.0 Method System.Void This method is called automatically by ASP.NET when the control is initialized. Tracks view-state changes to the control so they can be stored in the control's object. This object is accessible through the property. 2.0.0.0