I have something like this:
<div class="floatLeft"> |
<asp:Image ID="hlpSearchDeleted" runat="server" ImageUrl="~/smallHelp.gif" |
CssClass="helpIcon" AlternateText="Help"/> |
</div> |
<telerik:RadToolTip ID="rtpSearchDeleted" runat="server" TargetControlID="hlpSearchDeleted" |
HideEvent="LeaveTargetAndToolTip" Position="TopRight" > |
<div style="width: 310px; padding: 5px;"> |
<p class="info"> |
This is my tooltip info.</p> |
</div> |
</telerik:RadToolTip> |
It seems that Q1 now shows the text from AlternateText not my content. If I remove AlternateText, my tooltip is showed.
Is this a bug or is this desired ? Otherwise, how to control this behavior?
11 Answers, 1 is accepted
You are correct that the behavior regarding the separate tooltip and the Alt attribute has been changed. Note, however, that one of the main purposes [among others] of RadToolTip is to be used as a replacement of the "standard browser tooltip". This is the reason that the tooltip, as its highest priority reads the title or alt attribute of the element (as it is the title/alt attribute that causes a browser tooltip to be displayed).
As a result, in fact there are 4 ways to display content in a tooltip - by reading its TargetControl's title attribute, by setting the RadToolTip's Text property, or by writing HTML between the RadToolTip opening and closing tags.
Here is the correct priority for the three approaches to setting the RadToolTip content:
1. RadToolTip Text property
2. [target control] title attribute / ToolTip server property
3. alt attribute/AlternateText server property
4. RadToolTip content between opening/closing tags
Since the tooltip manager used to work like above explained from its creation when autotooltipify is used, we got customers` requests to make this behavior consistent and the same for the separate RadToolTip as well.
Note, that before this when a separate RadToolTip was used the Alt was removed as well - this is needed because under IE6 and IE7 this causes double tooltips - one standard generated from the Alt and one RadToolTip. This being said the only actual change is that the separate tooltip now gets the Alt text as the standard and also as the tooltip manager works. This change is also documented below:
http://www.telerik.com/products/aspnet-ajax/whats-new/release-history/q3-2009-sp2-version-2009-3-1314-2367038387.aspx
What I can suggest to do in order achieve what you need is either not to set the Alt or to use some simple js code as the one shown below which I prepared for you:
<
form
id
=
"form1"
runat
=
"server"
>
<
asp:ScriptManager
ID
=
"ScriptManager1"
runat
=
"server"
>
</
asp:ScriptManager
>
<
script
type
=
"text/javascript"
>
function setToolTip()
{
var img = $get("<%=imgRating.ClientID %>");
var alt = img.getAttribute('alt');
var regTooltip = img.getAttribute('regulartooltip');
if(!alt || alt == '') img.setAttribute('alt', regTooltip);
}
</
script
>
<
img
src
=
"Sunset.jpg"
runat
=
"server"
onmouseover
=
"setToolTip();"
regulartooltip
=
"myStandardTooltip"
id
=
"imgRating"
alt
=
"Rate this Page"
width
=
"55"
height
=
"16"
/>
<
telerik:RadToolTip
runat
=
"server"
ID
=
"tipRating"
Title
=
"What do you think?"
Skin
=
"Office2007"
Animation
=
"None"
xManualClose
=
"true"
Sticky
=
"false"
ShowEvent
=
"OnMouseOver"
HideEvent
=
"LeaveTargetAndToolTip"
Width
=
"275"
Position
=
"BottomLeft"
RelativeTo
=
"Element"
OffsetX
=
"0"
OffsetY
=
"0"
TargetControlID
=
"imgRating"
IsClientID
=
"false"
>
Enter an optional comment with your rating:
<
textarea
id
=
"tbRatingComment"
rows
=
"3"
cols
=
"30"
></
textarea
>
<
small
>Report technical problems with this site to the <
a
href
=
"mailto:sasupport@case.edu"
>
webmaster</
a
>.</
small
>
</
telerik:RadToolTip
>
</
form
>
Kind regards,
Svetlina
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
I am glad to hear that my explanation was detailed enough and understandable. I also understand your point but as you see the scenario is pretty complex and this is the best solution we have found till now. However we are continuously gathering feedback and if a better solution appears we will consider changing the current implementation.
Best wishes,
Svetlina
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
(name to be choosen ofc)
TooltipOrder
where
public enum TooltipOrder
{
AltContent
ContentAlt
}
Where Alt means use the Alt text of the target and Content means use explicit content from the tooltip.
I logged your suggestion in our database for consideration. However, before we change the code we gather feedback and we discuss how to proceed and thus I cannot ensure that this will be implemented.
Thank you once again for your suggestion, we will take it into account. If you face problems, do not hesitate to contact us!
Regards,
Svetlina
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
What is Telerik's standard way of collecting user feedback on features? Might I suggest creating a simple poll to get feedback on this one. Because, as we already discussed here and here, I honestly believe that the behavior change is not an improvement for RadTooltip's users.
That being said, I agree with Roland's suggestion...
Dominic.
I am glad to inform you that we decided to implement a new property which will help in controlling the behavior related to the Alt attribute. The new property will be most probably available for the official Q2 2010 release and its default value will be such that the behavior will stay the same as it is now but by setting it explicitly you will be able to avoid removing the Alt.
Greetings,
Svetlina
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
Thanks for the follow up,
Dominic.