This is another one of those new controls that inherits from WebControl instead of HtmlControl. What's nice is that you can define hotspots just as you could with the original control, but you can specify whether the control navigates to a particular URL or it does a post back. To determine what the control does set the HotSpotMode property to either Navigate or PostBack. To have it go to a particular URL, set the NavigateUrl property. When you are doing a postback, set the PostBackValue property (which works similarly to the CommandeName property of a button control).
Here is an example:
<asp:ImageMap id="MyImageMap" ImageUrl="Blah.jpg" hotspotmode="PostBack" OnClick="MyImageMap_Click" runat="server">
<asp:RectagnleHotSpot top="0" left="0" bottom="50" right="50" postbackvalue="HotSpot1" />
<asp:RectagnleHotSpot top="50" left="50" bottom="100" right="100" postbackvalue="HotSpot2" />
<asp:CircleHotSpot" x="200" y="200" radius="25" hotspotmode="Navigate" NavigateUrl="/blah.aspx" />
</asp:ImageMap>
In this example, the fire RectangleHotSpot actually does a post back with a value of HotSpot1, and the CircleHotSpot navigates to a new url. You can also create PolygonHotSpots.
The event handling method handling the click event would look like this:
protected void MyImageMap_Clicked(Object sender, ImageMapEventArgs e)
{
if (e.Value == "HotSpot1")
{
// do something
}
else if (e.Value == "HotSpot2")
{
// do something else
}
}
As you can see this control is a lot more functional than in the past.
Read the complete post at http://www.dotnettipoftheday.com/blog.aspx?id=191