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

Does RadRichtextBox convert the HTML tags in

1 Answer 145 Views
RichTextBox
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Shiv
Top achievements
Rank 1
Shiv asked on 21 May 2012, 10:21 PM
Hi 

I'm working on radrichtext box and my application also allows the user to have basic html tags while entering the text..
For example:

This is for <b>testing</b>.  //using radrichtextbox

 <telerik:RadRichTextBox x:Name="BodyText" Grid.Row="1" HorizontalAlignment="Stretch" IsSpellCheckingEnabled="False"
                                    AcceptsReturn="True" VerticalScrollBarVisibility="Auto" >
                <telerik:RadRichTextBox.Resources>
                <html:HtmlDataProvider x:Name="HtmlDataProvider" Html="{Binding Path=Body,Mode=TwoWay}" RichTextBox="{Binding ElementName=BodyText}" />
                </telerik:RadRichTextBox.Resources>
                            </telerik:RadRichTextBox>

I'm loading up the data from the  above richtextbox into  another radrichtextbox 
And when I load up the text back into another radrichtextbox these tags should be parsed and the testing should be shown in bold. 

The html text I'm getting is :

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8" /><title>Untitled</title><style type="text/css">
.p_CC664AAA { margin: 0px 0px 12px 0px;text-align: left;text-indent: 0pt;padding: 0px 0px 0px 0px; } 
.s_1681A555 { font-family: 'Times New Roman';font-style: Normal;font-weight: normal;font-size: 16px;color: #000000; } 
.s_71516F31 { font-family: 'Times New Roman';font-style: Normal;font-weight: bold;font-size: 16px;color: #000000; } 
</style></head><body><p class="p_CC664AAA"><span class="s_1681A555">dfhgsfdh </span><span class="s_71516F31">test</span></p><p class="p_CC664AAA"><span class="s_1681A555">&lt;p&gt;&lt;b&gt;This text is bold&lt;/b&gt;&lt;/p&gt;</span><span class="s_71516F31" /></p></body></html>

The radrichtextbox is replacing the <> </> the tags with some other symbols(highlighted in bold).. Thus radrichtextbox is not able to convert while loading back. 


Can we do this with radrichtextbox? 

I'm using HTML dataprovider.

1 Answer, 1 is accepted

Sort by
0
Iva Toteva
Telerik team
answered on 23 May 2012, 05:32 PM
Hello Shiv,

If you have the symbols "<", ">" as text in the editor, when you use HtmlFormatProvider or HtmlDataProvider to export the document, these characters will be escaped and will appear as &lt; and &gt; in the resulting HTML string. This ensures that the document will look correctly if viewed in a browser right away or imported back in the editor.

Perhaps, at some point you have set the text of the editor to "<b>testing</b>" instead of using HtmlFormatProvider to import it and have it appear as testing. If you are not able to resolve the issue, we would appreciate a sample demo, so that we can see your implementation and advise you further.

Greetings,
Iva Toteva
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

Tags
RichTextBox
Asked by
Shiv
Top achievements
Rank 1
Answers by
Iva Toteva
Telerik team
Share this question
or