[Abstract] In this article, I will show you how to use the ASP.NET AJAX framework to extend the HTML Map control to add clickable hotspots. After expansion, when our mouse moves over these hotspots, detailed information about these hotspots will pop up; however, these detailed information are obtained from the remote service asynchronously through AJAX.
First of all, we noticed that ASP.NET 2.0 also provides a server control ImageMap. This control is a server control that allows you to define hotspot areas on images . Users can perform postback operations or forward to a certain URL address by clicking on these hotspot areas. Typically, this control is used to perform interactive operations on a local area of a picture. However, the disadvantage of this control is that clicking on these hot spots for postback will cause the entire web page to refresh.
In this article, we will extend the ordinary HTML Map control based on ASP.NET AJAX technology so that when clicking on the hotspot area, it will only cause partial page updates when displaying relevant detailed information, thereby adapting it to the Web. 2.0 application development trend.
Figure 1 below shows a snapshot of the sample program running in this article.
Figure 1. Map control hotspot clicks expanded using AJAX technology only trigger local updates.
As you can see from the picture above, when the mouse is hovered over Jupiter (Jupiter) in the solar system above, detailed information about the planet will be friendlyly displayed in the form of a pop-up window (Note: This picture is taken from MSDN and is not available here. Translate the corresponding word).
Start Visual Studio 2005, select "File → New Website...", then select the "ASP.NET AJAX-Enabled Web Site" template, name the project "Ajax_ImageMap", and select C# as the built-in support language. Finally click OK.
Then, add a new ASPX page, ImageMap.aspx, and modify the HTML code section as follows: