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

3 posts, 0 answers
  1. Michael Hunt
    Michael Hunt avatar
    42 posts
    Member since:
    Aug 2009

    Posted 17 Sep 2012 Link to this post


    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?

  2. Marin Bratanov
    Marin Bratanov avatar
    3908 posts

    Posted 19 Sep 2012 Link to this post

    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.

    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.
  3. Michael Hunt
    Michael Hunt avatar
    42 posts
    Member since:
    Aug 2009

    Posted 01 Oct 2012 Link to this post

    Thanks for the reply Marin.  I decided to go a different direction, and now use a javascript function to display the tooltips.
Back to Top