473,763 Members | 1,377 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

I want to derive a new asp:circlehotsp ot control - need some help

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.

Nov 8 '06 #1
3 2643
Hello Dean,

As for the ASP.NET ImageMap control you mentioned, it can support multi
HotSpot items as below:

===========
<asp:ImageMap ID="ImageMap1" runat="server" HotSpotMode="Po stBack"
ImageUrl="~/Images/simplemap.JPG">
<asp:CircleHotS pot AlternateText=" hotspot00" Radius="50"
X="100" Y="100" />
<asp:CircleHotS pot AlternateText=" hotspot01" Radius="50"
X="300" Y="300" />
<asp:PolygonHot Spot
Coordinates="0, 0,176,0,125,182 ,227,400,0,400" AlternateText=" polyhotspot"/>
<asp:RectangleH otSpot Left="150" Top="100" Right="250"
Bottom="300" AlternateText=" rectspot" />
</asp:ImageMap>
=============== ======

The CircleHotSpot ,RectangleHotSp ot and RectangleHotSpo t are not
webcontrols, they are just normal classes dervied from the HotSpot super
class. And it is the ImageMap control which will render the output html
based on all the HotSpot items in its "HotSpots" collection.

Actually the above aspx control template will result to the following html
output in client browser:

=============== ====
<img id="ImageMap1" src="Images/simplemap.JPG" usemap="#ImageM apImageMap1"
style="border-width:0px;" /><map name="ImageMapI mageMap1">
<area shape="circle" coords="100,100 ,50"
href="javascrip t:__doPostBack( 'ImageMap1','0' )" title="hotspot0 0"
alt="hotspot00" /><area shape="circle" coords="300,300 ,50"
href="javascrip t:__doPostBack( 'ImageMap1','1' )" title="hotspot0 1"
alt="hotspot01" /><area shape="poly"
coords="0,0,176 ,0,125,182,227, 400,0,400"
href="javascrip t:__doPostBack( 'ImageMap1','2' )" title="polyhots pot"
alt="polyhotspo t" /><area shape="rect" coords="150,100 ,250,300"
href="javascrip t:__doPostBack( 'ImageMap1','3' )" title="rectspot "
alt="rectspot" />
</map>
=============== ===

You will find that HotSpot(and its derived classes) are actually
represented by a <areaelement in html(which is child of <mapelement).

#HTML <areatag
http://www.w3schools.com/tags/tag_area.asp

#HTML <MAP>
http://www.htmlcodetutorial.com/images/_MAP.html

So for your scenario, if you want to develop a custom HotSpot class, you
can simply create a class derived from System.Web.UI.W ebControls.HotS pot
and override the certain methods you need. And the "MarkupName " property
and the "GetCoordinates " method are two important members you need to
override for your custom HotSpot class:

** MarkupName determine the value will be rendered as the "shape" attribute
of the <areaelement. It seems there are three possible values so far,
they are "circle", "rect" and "poly", for any non-circle and non-rectangle
shape, you can just use "poly" as the value.

** "GetCoordinates " method return the string value that will be rendered as
the "coords" atribute of <areaelement. And it's value should be different
according to the "shape" attribute(Marku pName).

You can have a look at the above two articles about html <area>,<mapfo r
detailed info.

Hope this helps some.
Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead

=============== =============== =============== =====

Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscripti...ult.aspx#notif
ications.

Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscripti...t/default.aspx.

=============== =============== =============== =====

This posting is provided "AS IS" with no warranties, and confers no rights.

Nov 9 '06 #2
Hi Dean,

How are you doing on this issue, does the information in my last reply
helps you some?

Please feel free to post here if there is anything else we can help.

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead
This posting is provided "AS IS" with no warranties, and confers no rights.

Nov 13 '06 #3
Acutally I figured out how to do what I needed with CSS. But yes, your post
did help, I appreciate it. It gave me some more ideas and insight into how
that control (class) works.

It wasn't just a hotspot that I ended up needing. I'm using some other
controls and I needed to be able to produce seperate "ID" entries so that I
could tell the other control what its targets were, like "ID='Florid a'",
"ID='California '" and "ID='Texas' ".

Thanks again Steven.
Dean

"Steven Cheng[MSFT]" <st*****@online .microsoft.comw rote in message
news:SB******** *****@TK2MSFTNG XA01.phx.gbl...
Hi Dean,

How are you doing on this issue, does the information in my last reply
helps you some?

Please feel free to post here if there is anything else we can help.

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead
This posting is provided "AS IS" with no warranties, and confers no
rights.

Nov 13 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

9
1401
by: Mactash | last post by:
Folks, I have problem running simplest ASP.Net programs with IIS web server. As a test I just added some text box and dropdown list with Visual Studio but when I run this my page shows nothing.(blank page without error.) I can run this with asp matrix web server. Can you please let me know what is wrong.? Thank you .
1
1970
by: Neil Zanella | last post by:
Hello, I would like to ask a question pertaining to programmatic initialization of ASP web controls (as opposed to initialization via standalone attributes and other elements contained in the enclosing ASP control element)... Given an ASP web control that supports specifying an initialization event handler via the onInit attribute, what is the difference between placing initialization
2
1170
by: kentg | last post by:
How do I "build" the name of an ASP control in the VB Code behind? I would like to cycle through several comboboxes using a loop. (cboReport1, cboReport2, cboReport3, etc.) ie. in MS-Access I can use the following code to reference a combobox named cboReport6 and set it's value to 1: strForm = MyForm strControlName = "cboReport" intCount = 6
2
2005
by: parm | last post by:
How do I highlight text in my first (tabindex = 1) asp control (eg: textbox) on the webform on page load. If I try to set focus using javascript then I get script error "Cannot move focus to invisible control)". Because the tabindex of first control is 1 therfore I can get the focus on first control but the text inside is not highlighted. Any help would be greatly appriciated. My set focus javascript: Public Sub SetFocus(ByRef MyPage As...
3
6856
by: BlueSky | last post by:
Hi All, Is there an equivalent html control or asp control in .NET that does the following - <ul> <li>list item1</li> <li>list item2</li> <li>list item3</li> </ul> Thanks for any tip!
3
5603
by: Frederik Borg | last post by:
Hi I would like to use script to access an asp control client side. The asp control and script is located in a content page. I use the control's ID to call it: <button onclick="SomeOtherControl.click();">Remove</button> Unfortunately the ID of SomeOtherControl gets changed when using master pages. It owrks perfect when using regualar flat aspx pages.
4
1601
by: drop | last post by:
Hi, I need to know if there is an ASP control in which I can easily paste some HTML code. Basically, we have a management application in which the client can enter it's product description. The client wants to be able to enter HTML in the description textbox so he can customize the presentation of his description.
1
1593
by: activey | last post by:
Hi there, How can I change the value of an asp control by javascript, could you please tell me your perofessional opinion about this. Thanks,
3
1453
by: santa19992000 | last post by:
New to .NET ASP, need to start a project (web project) using .NET ASP, do I have to buy any Software to install, how can I start, appreciated for any oinputs ot any links about how to learn .NET ASP. Thanks in advance. SR.
0
9563
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9386
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10145
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
9938
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9822
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8822
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7366
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5270
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5406
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.