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

    Hi,

     

    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?

     

    Zaly

  2. Answer
    Marin Bratanov
    Admin
    Marin Bratanov avatar
    3602 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>
    </telerik:RadToolTip>
    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>";

    Regards,

    Marin Bratanov
    Telerik
    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. UI for ASP.NET Ajax is Ready for VS 2017
  4. 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.

    Regards,

    Zaly

Back to Top