HotSpotMode Enumeration

Note: This enumeration is new in the .NET Framework version 2.0.

Specifies the behaviors of a HotSpot object in an ImageMap control when the HotSpot is clicked.

Namespace: System.Web.UI.WebControls
Assembly: System.Web (in system.web.dll)

public enum HotSpotMode
public enum HotSpotMode
public enum HotSpotMode

 Member nameDescription
InactiveThe HotSpot does not have any behavior. 
NavigateThe HotSpot navigates to a URL. 
NotSetThe HotSpot uses the behavior set by the ImageMap control's HotSpotMode property. If the ImageMap control does not define the behavior, the HotSpot object navigates to a URL. 
PostBackThe HotSpot generates a postback to the server. 

The HotSpotMode enumeration represents the behaviors that you can apply to a HotSpot object within an ImageMap control. The ImageMap.HotSpotMode and the HotSpot.HotSpotMode properties use these enumeration values to set the behavior of a HotSpot object when it is clicked. If both properties are set, the HotSpot.HotSpotMode property specified on each individual HotSpot object takes precedence over the ImageMap.HotSpotMode property on the control.

If you specify HotSpotMode.NotSet for the HotSpot.HotSpotMode property of an individual HotSpot object, the HotSpot gets its behavior from the containing ImageMap control's ImageMap.HotSpotMode property. In this scenario, if the ImageMap control's HotSpotMode property is either NotSet or no value is specified, the default behavior is to navigate to a URL.


If an ImageMap control's behavior is not specified using either the ImageMap.HotSpotMode property or the HotSpot.HotSpotMode property on the HotSpot objects it contains, by default the behavior is HotSpotMode.Navigate. In addition, if the HotSpot.HotSpotMode properties on the HotSpot objects that an ImageMap control contains are set to HotSpotMode.NotSet and no value is specified for the ImageMap.HotSpotMode property, the default behavior is HotSpotMode.Navigate.

If you specify HotSpotMode.Navigate for either the ImageMap.HotSpotMode property or the HotSpot.HotSpotMode property, the page navigates to a URL when the HotSpot is clicked. Use the Image.NavigateUrl or the HotSpot.NavigateUrl property to specify the URL to navigate to.

If you specify HotSpotMode.PostBack for either the ImageMap.HotSpotMode property or the HotSpot.HotSpotMode property, the page generates a postback to the server when the HotSpot is clicked. Use the PostBackValue property to specify a name for the HotSpot object. This name will be passed in the ImageMapEventArgs event data when the postback event occurs. When a postback HotSpot is clicked, the Click event is raised. To programmatically control the actions performed when a postback HotSpot is clicked, provide an event handler for the Click event.

If you specify HotSpotMode.Inactive for the HotSpot.HotSpotMode property, the HotSpot 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 ImageMap control.

To create an inactive area within an active hot spot, you must specify the inactive hot spot before the active one in the ImageMap control. For example, the following ImageMap defines an active ring by specifying an inactive circular hot spot within a larger active circular hot spot:

    <asp:ImageMap ID="SaturnImage" 
           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 />
How to: Add ImageMap Web Server Controls to a Web Page (Visual Studio)Building ASP .NET Web Applications in Visual Studio

The following code example demonstrates how to use the HotSpotMode enumeration values to set the ImageMap.HotSpotMode property. The page contains an ImageMap control that contains two RectangleHotSpot objects. The ImageMap.HotSpotMode property is set to HotSpotMode.PostBack, which causes the page to post back to the server each time a user clicks one of the hot spot regions. The HotSpotMode property is not set on either of the RectangleHotSpot objects because they get their behavior from the ImageMap.HotSpotMode property. For this example to work correctly, you must supply your own image for the ImageUrl property and update the path to the image appropriately so that the application can locate it.

<%@ page language="C#" %>

<script runat="server">
  void VoteMap_Clicked(object sender, ImageMapEventArgs e)
    // When a user clicks the "Yes" hot spot,
    // display the hot spot's value.
    if (e.PostBackValue == "Yes")
      Message1.Text = "You selected " + e.PostBackValue + ".";
    else if (e.PostBackValue == "No") 
      // When a user clicks the "No" hot spot,
      // display the hot spot's value.       
      Message1.Text = "You selected " + e.PostBackValue + ".";
      Message1.Text = "You did not click a valid hot spot region.";             

<head id="Head1" runat="server">
  <title>ImageMap.HotSpotMode Example</title>
    <form id="Form1" runat="server">
      <h3>ImageMap.HotSpotMode Example</h3>
      <!--The RectangleHotSpot objects have the post back
        behavior specified by the HotSpotMode 
        property on the ImageMap control.-->
      <asp:imagemap id="Vote"           
        alternatetext="Vote choices" 
          alternatetext="Vote yes">
          alternatetext="Vote no">
      <br />
      <asp:label id="Message1"

Windows 98, Windows 2000 SP4, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see System Requirements.

.NET Framework

Supported in: 2.0