Mega Code Archive

 
Categories / ASP.Net Tutorial / ASP Net Controls
 

Important properties, events and methods of ImageMap control

AccessKey:        a key that navigates to the ImageMap control. AlternateText:    alternate text for the image (required for accessibility). DescriptionUrl:   a link to a page which contains a detailed description of the image. GenerateEmptyAlternateText: set the AlternateText property to an empty string.        HotSpotMode:      the behavior of the image map when you click a region.                    Possible values are Inactive, Navigate, NotSet, and PostBack. HotSpots:         retrieve the collection of HotSpots contained in the ImageMap control. ImageAlign:       align the image map with other HTML elements in the page.                    Possible values are AbsBottom, AbsMiddle, Baseline, Bottom,                    Left, Middle, NotSet, Right, TextTop, and Top. ImageUrl:         specify the URL to the image. TabIndex:         the tab order of the ImageMap control. Target:           open a page in a new window. Focus:            set the initial form focus to the ImageMap control. Click:            Raised when you click a region of the ImageMap and                    the HotSpotMode property is set to the value PostBack. An ImageMap control is composed out of instances of the HotSpot class.  A HotSpot defines the clickable regions in an image map.  The ASP.NET framework has with three HotSpot classes: CircleHotSpot:     a circular region in an image map. PolygonHotSpot:    an irregularly shaped region in an image map. RectangleHotSpot:  a rectangular region in an image map. <%@ Page Language="C#" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" > <head id="Head1" runat="server">     <title>ImageMap Navigate</title> </head> <body>     <form id="form1" runat="server">     <div>     <asp:ImageMap         id="mapNavigate"         ImageUrl="yourImage.jpg"         Runat="server">         <asp:RectangleHotSpot             NavigateUrl="Home.aspx"             Left="0"             Top="0"             Right="100"             Bottom="50"             AlternateText="Navigate to Home" />         <asp:RectangleHotSpot             NavigateUrl="Products.aspx"             Left="100"             Top="0"             Right="200"             Bottom="50"             AlternateText="Navigate to Products" />         <asp:RectangleHotSpot             NavigateUrl="Services.aspx"             Left="200"             Top="0"             Right="300"             Bottom="50"             AlternateText="Navigate to Services" />     </asp:ImageMap>     </div>     </form> </body> </html>