Showing RadEditor content in Tooltip

3 posts, 1 answers
  1. Zaly
    Zaly avatar
    7 posts
    Member since:
    Sep 2011

    Posted 05 Sep 2015 Link to this post



    I saved the content of RadEditor to a database. The saved content includes all the HTML mark-ups (e.g. <​strong>Company</strong>).

    The question is when I retrieved the content from the database and bind to a label's tooltip, it shows the mark-up (e.g. <​strong>Company</strong>) instead of the formatted output (i.e. "Company" as a bold text).

    What is the correct way of showing the tooltip with formatted content from RadEditor?



  2. Answer
    Marin Bratanov
    Marin Bratanov avatar
    5912 posts

    Posted 08 Sep 2015 Link to this post

    Hi Zaly,

    How exactly do you assign the HTML content to the tooltip? If you bind it to the title attribute of an HTML element (its ToolTip server property), the framework will HTML encode your content (I am attaching a screenshot) and the browser will not render the HTML, but if you pass it directly to the RadToolTip control, you should not have issues.

    Here are a few examples:

    with the Text property

    RadToolTip1.Text="<strong>bold text</strong>";

    with a control in its tags

    <telerik:RadToolTip ID="RadToolTip1" runat="server" VisibleOnPageLoad="true">
        <div runat="server" id="content"></div>
    content.InnerHtml="<strong>bold text</strong>";

    with a target that has HTML in its title attribute (based on the screenshot)

    <asp:Label ID="Label1" Text="label for textbox" AssociatedControlID="Textbox1" runat="server" />
    <asp:TextBox ID="Textbox1" runat="server" />
    <telerik:RadToolTip ID="RadToolTip1" runat="server" TargetControlID="Label1"></telerik:RadToolTip>
    Label1.ToolTip="<strong>bold text</strong>";


    Marin Bratanov
    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 Feedback Portal and vote to affect the priority of the items
  3. Zaly
    Zaly avatar
    7 posts
    Member since:
    Sep 2011

    Posted 13 Sep 2015 in reply to Marin Bratanov Link to this post

    Hi Marin,

    Thanks for the answer. Your solution works.



Back to Top