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

Label and radmarkupeditor

3 Answers 153 Views
TextBox
This is a migrated thread and some comments may be shown as answers.
Jason Parrish
Top achievements
Rank 1
Jason Parrish asked on 09 Mar 2011, 11:03 PM
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!

3 Answers, 1 is accepted

Sort by
0
Jason Parrish
Top achievements
Rank 1
answered on 09 Mar 2011, 11:58 PM
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?
0
Jason Parrish
Top achievements
Rank 1
answered on 10 Mar 2011, 06:58 PM
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.


0
Peter
Telerik team
answered on 15 Mar 2011, 02:52 PM
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!
Tags
TextBox
Asked by
Jason Parrish
Top achievements
Rank 1
Answers by
Jason Parrish
Top achievements
Rank 1
Peter
Telerik team
Share this question
or