ImageMap control in ASP.NET

In this article we will learn how to use ImageMap control in ASP.NET.
  • 2752

In this article we will learn how to use ImageMap control in ASP.NET.

ImageMap control

An image map is an image that has several clickable region, called hot spots. The ImageMap control lets you create three types of hot spots: rectangles, circles, polygons.

Properties: These are the following ImageMap properties.

imagemap1.gif
 

Figure 1.

ImageUrl -  Url of image location.

AlternetText  - Appears if image not loaded properly.

Tooltip - Appears when on mouse over the image.

ImageAlign - Used to align the Text beside image.

HotSpotMode - Navigate, the user is navigated to a different URL. In case of PostBack, the page is posted back to the server.

For example:

Drag a ImageMap control from the Toolbox on the form. The form looks like this.

imagemap2.gif
 

Figure 2.

Now add three new page Hotspot1.aspx, Hotspot2.aspx, Hotspot3.aspx with the normal image control and make a folder images and add three image in the solution explorer and add with every page.

imagemap3.gif
 

Figure 3.

imagemap4.gif
 

Figure 4.
 

Now select ImageMap control press F4 for property window and click on the HotSpotMode property.

imagemap5.gif
 

Figure 5.
 

Now save and run the application.

imagemap6.gif
 

Figure 6.
 

Now click on the Hotspot1.

imagemap7.gif
 

Figure 7.
 

Now click on the Hotspot 2.

imagemap8.gif
 

Figure 8.
 

Now click on the Hotspot3.

imagemap9.gif
 

Figure 9.

Categories

More Articles

© 2020 DotNetHeaven. All rights reserved.