Label and radmarkupeditor

4 posts, 0 answers
  1. Jason Parrish
    Jason Parrish avatar
    87 posts
    Member since:
    Sep 2009

    Posted 09 Mar 2011 Link to this post

    I am needing to display some text on my form which has some older HTML tags, e.g. FONT, and other HTML tags.  

    The radlabel does not display the HTML properly even when wrapped in "<HTML>".  However, if I set the value of the radmarkupeditor to the HTML, it is displayed properly.  In fact, when I hit APPLY, it actually converts the older tags to more compliant versions, ala SPAN tags with STYLE attributes.

    How can I get the label to display the HTML properly?  Or which control does the radmarkupeditor take advantage of?  Or can I call the internal "convert" method somehow?

    Please advise!
  2. Jason Parrish
    Jason Parrish avatar
    87 posts
    Member since:
    Sep 2009

    Posted 09 Mar 2011 Link to this post

    I see a similar issue in Design-Time as well.  While testing what the label would look using some "old" html, I discovered what you see in the editor is not always correctly displayed in the label.  See screenshot #1.

    And during run-time, when I set the label's text to the exact same HTML I used in design-time, I get another different rendering altogether.  See screenshot #2.

    What is going on there???

    As you can see from the first screenshot, the HTML rendering is what I would expect to see in the label. So, is it possible to do that?
  3. UI for WinForms is Visual Studio 2017 Ready
  4. Jason Parrish
    Jason Parrish avatar
    87 posts
    Member since:
    Sep 2009

    Posted 10 Mar 2011 Link to this post

    After looking deeper into the radmarkupeditor, the control you are using to display the HTML preview is not a Telerik control, but instead it appears to be either using or inheriting the WebBrowser control.  And then the body is setting it's ContentEditable attribute to true.

    Is that the case or something similar?  If so, that explains the discrepancy in how the RadLabel is displaying the HTML.  Therefor, I can replace where am I using the RadLabel with the WebBrowser control to ensure my older HTML is displayed properly.  For newer HTML entries, I will still be able to use the RadMarkupDialog.

    Either way, I'd like some input from Telerik on what I am experiencing should be expected or not.


  5. Peter
    Admin
    Peter avatar
    1148 posts

    Posted 15 Mar 2011 Link to this post

    Hello Jason, 

    Thanks for the writing.

    Our Markup Editor uses the rendering engine of Internet Explorer (Trident). On the other hand, our HTML-like text formatting is a custom rendering engine developed for RadControls for WinForms and providing a text styling mechanism, which can be quickly applied to all Telerik controls and their elements. It enhances one of the smallest element in the Telerik Presentation Framework -  the TextPrimitive. The rich text formatting mechanism uses a few plain HTML tags to display the formatted text such as font style, font color, font size, etc. Because of this, you may expect some inconsistencies between our Markup editor and the TPF rendering engine.

    Do not hesitate to contact us if you have other questions.

    All the best,
    Peter
    the Telerik team
    Registration for Q1 2011 What’s New Webinar Week is now open. Mark your calendar for the week starting March 21st and book your seat for a walk through all the exciting stuff we ship with the new release!
Back to Top