I'm working with the new ASP.NET AJAX Control Toolkit. I have a map that
has several key areas (hot spots) where when the user hovers over them, I
want to pop up a small window with information in it (text, graphics,
whatever). I am using the asp:ImageMap control and I can use the
asp:circlehotsp ot control, but that only allows me to have a single hotspot.
What I want to do is create a new custom control that derives everything
from this circlehotspot, but adds an "ID" property. If I can reference
that, then I have have multiple hotspots on the image and each one can
trigger a different hover/pop-up panel.
I have never done this before, so I need some guidance. Where I'm running
into trouble is that there are two functions (MarkupName() and
GetCoordinates( )) that are 'must override' in the base class. I don't want
to change them, but I have no idea what they are supposed to return. I
copied part of this from a page I found on the net where the guy was doing
something similar with the hotspot controls, but he was creating another
type (circle, rectangle, polygon, he was adding a 'diamond' shape). So the
code in the MarkupName() and GetCoordinates( ) are the two areas I'm having
trouble with and are his original code which doesn't apply to what I'm
trying to do at all. Here's what I've got so far:
Imports Microsoft.Visua lBasic
Namespace foo
Public Class customcirclehot spot
Inherits System.Web.UI.W ebControls.HotS pot
Public Sub New()
MyBase.New()
End Sub
Public Sub New(ByVal ID As String)
MyBase.New()
Me.ID = ID
End Sub
Public Property ID() As String
Get
Dim val As Object = ViewState("id")
If val Is Nothing Then
Return ""
Else
Return CStr(val)
End If
End Get
Set(ByVal value As String)
ViewState("id") = value
End Set
End Property
Protected Overrides ReadOnly Property MarkupName() As String
Get
Return "poly"
End Get
End Property
Public Overrides Function GetCoordinates( ) As String
Return CenterX.ToStrin g() & "," & (CenterY - Height / 2).ToString()
& "," & _
(CenterX + Width / 2).ToString() & "," & CenterY.ToStrin g()
& "," & _
CenterX.ToStrin g() & "," & (CenterY + Height /
2).ToString() & "," & _
(CenterX - Width / 2).ToString() & "," & CenterY.ToStrin g()
End Function
End Class
End Namespace
Am I doing it right? What do I do about the MarkupName() property and
GetCoordinates( ) function? I don't even know what the MarkupName is. Could
I do something as simple as Return "customcircleho tspot"?
What about the GetCoordinates( ) function? I have no idea what the original
returns and I don't need to change it. All I need to do is add an ID
property so the individual hotspots can be referenced by other controls.
Thanks in advance for any and all help.