HotSpotCollection.Item Property (Int32)
.NET Framework (current version)
Gets a reference to the HotSpot object at the specified index in the HotSpotCollection collection.
Assembly: System.Web (in System.Web.dll)
Parameters
- index
-
Type:
System.Int32
The ordinal index value that specifies the location of the HotSpot object in the collection.
Property Value
Type: System.Web.UI.WebControls.HotSpotThe HotSpot object at the specified index in the HotSpotCollection collection.
The following code example demonstrates how to use the Item property to directly access the HotSpot objects contained in the ImageMap control's HotSpotCollection collection and display the value of each object's AlternateText property in a label on the page. For this example to work correctly, you must supply your own image for the ImageUrl property and update the path to the image appropriately so that the application can locate it.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <script runat="server" language="vb"> Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs) ' Use the Item property to access each object in the ' HotSpotCollection and display the value of ' its AlternateText property to the user. For i As Integer = 0 To Shop.HotSpots.Count - 1 Label1.Text += "<br />" + Shop.HotSpots.Item(i).AlternateText + "<br />" Next End Sub </script> <html xmlns="http://www.w3.org/1999/xhtml" > <head id="Head1" runat="server"> <title>HotSpotCollection.Item Property Example</title> </head> <body> <form id="Form1" runat="server"> <h3>HotSpotCollection.Item Property Example</h3> <h4>Shopping Choices:</h4> <asp:imagemap id="Shop" imageurl="Images/ShopChoice.jpg" alternatetext="Shopping choices" runat="Server"> <asp:circlehotspot navigateurl="http://www.tailspintoys.com" x="145" y="120" radius="75" hotspotmode="Navigate" alternatetext="Shop for toys"> </asp:circlehotspot> <asp:circlehotspot navigateurl="http://www.cohowinery.com" x="145" y="290" radius="75" hotspotmode="Navigate" alternatetext="Shop for wine"> </asp:circlehotspot> </asp:imagemap> <asp:label id="Label1" runat="Server"> </asp:label> </form> </body> </html>
.NET Framework
Available since 2.0
Available since 2.0
Show: