This is a migrated thread and some comments may be shown as answers.

Want to AutoTooltipify an img in an html string created in server-side code.

2 Answers 32 Views
ToolTip
This is a migrated thread and some comments may be shown as answers.
Michael Hunt
Top achievements
Rank 1
Michael Hunt asked on 17 Sep 2012, 12:56 PM
Hi,

I am using version 2011.3.1305.35 of the ASP.NET for AJAX controls.

I dynamically create the content of an ascx control, by creating strings that contain HTML and adding them to ASP.NET Tables / TableRows / TableCells.

The strings contain HTML elements like the div, span, and img elements.  I also have a RadTooltipManager on this user control, with AutoTooltipify="True".

When I view the source of the page, the strings I create end up looking like this:

<a class='bowlerTitleText' href='#' onclick="return expandCollapse('ctl00_cphContent_ucBowler1_tblBowler_bb8380','ctl00_cphContent_ucBowler1_tblBowler_bb8380i','True');"><img id='ctl00_cphContent_ucBowler1_tblBowler_bb8380i' class='upDown' src='../../img/icons/mnuCollapse.gif' /></a><span class='bowlerPeriodMiss'>Miss</span><span><img style='padding-left: 3px; vertical-align: bottom;' src='../../img/icons/talkBubble.gif' title='New Comment That can be up to 600 characters long.' /></span><span class='bowlerTitle2'>New Measurement</span>

In the example above, I'd want to tooltipify the <img> that has the title='New Comment...'

MY GOAL:
I want the 'title' attribute of my <img> elements, to be displayed by the RadTooltipManager.  Currently, the tooltips are displaying in the default browser tooltip box (ugly).  I know the radtooltipmanager is working properly as I have set the ToolTipTargetControl and TargetControlID for some asp controls in this page, and the tooltipmanager displays them correctly.

I don't expect how I'm doing it now to magically work, but How can I accomplish what I want?
Is it possible to achieve this the way I am doing it, by building HTML strings?

Thanks,
Michael

2 Answers, 1 is accepted

Sort by
0
Marin Bratanov
Telerik team
answered on 19 Sep 2012, 11:04 AM
Hi Michael,

If you have added target controls for the manager the autotooltipify functionality will not be in effect, as it is a generic option, while having targets is always an intentional action by the developer and takes precedence.

The easiest option I can suggest is to add another RadToolTipManager and use that to add automatic tooltips for everything on the page that has the title or alt attribute set.


Regards,
Marin Bratanov
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
0
Michael Hunt
Top achievements
Rank 1
answered on 01 Oct 2012, 01:25 PM
Thanks for the reply Marin.  I decided to go a different direction, and now use a javascript function to display the tooltips.
Tags
ToolTip
Asked by
Michael Hunt
Top achievements
Rank 1
Answers by
Marin Bratanov
Telerik team
Michael Hunt
Top achievements
Rank 1
Share this question
or