ImageMap Server Control

baronh said:
Hi, In the ASP.NET 2.0 there is a new ImageMap server control.

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnvs05/html/otherctrl.asp

However, I need one now. Does any body have/know of an example project that implements a similar control?

Many thanks.

AFAIK, there isn't an imagemap server control for ASP.NET 1.0 or 1.1. You can still handle the situation using a mix of the image server control and html controls. The following example should show you how to handle an image with pieces of the image mapped.

Code:
<asp:Image ID="imgMap" Runat="server" ImageUrl="image.gif" [B]USEMAP="#image_Map"[/B]></asp:Image>
[COLOR=RoyalBlue]<MAP NAME="image_Map">[/COLOR]
[COLOR=DarkRed]    <AREA SHAPE="poly" ALT="Area 1" COORDS="0,0, 0,100, 100,100, 100,0" HREF="ImageClick.aspx?Area=1">
    <AREA SHAPE="poly" ALT="Area 2" COORDS="0,100, 0,200, 100,200, 100,100" HREF="ImageClick.aspx?Area=2">
    <AREA SHAPE="poly" ALT="Area 3" COORDS="100,0, 100,100, 200,100, 200,0" HREF="ImageClick.aspx?Area=3">
    <AREA SHAPE="poly" ALT="Area 4" COORDS="100,100, 100,200, 200,200, 200,100" HREF="ImageClick.aspx?Area=4">[/COLOR]
[COLOR=RoyalBlue]</MAP>[/COLOR]

This is just an example of a square image 200px X 200px with the top left quarter being Area 1, the top right quarter being Area 2, the bottom left quarter being Area 3, and the bottom right quarter being Area 4.

Now I have not done this, but you could likely add ID and Runat=server attributes to the MAP and AREA tags to enable access to them in the code portion. This could be great for dynamically assigning the attributes. I can envision alot of good uses for this, such as stroring the info in a database and assigning different values based on different conditions.

Hope this helps.

Jeff B
 
Back
Top