Link to home
Start Free TrialLog in
Avatar of pamela rizk
pamela rizkFlag for Lebanon

asked on

AJaxControl toolkit html editor

dear All

i have an ajax html editor (editor1) i need to read its content and put it in an asp textbox (textbox1)
but for example if i wrote in the ajax html editor in bold
the content of the textbox will be textbox1.text = editor1.content

and since the content of the editor has the below format :<p><b>test</b></p>

the textbox will display the editor content the output is incorrect
how to solve it?
Avatar of Eddie Shipman
Eddie Shipman
Flag of United States of America image

Where did you get the control?
You will need to encode the HTML content when set value for the textbox:
textbox1.Text = HttpUtility.HtmlEncode(editor1.Content);

Open in new window


See reference here.
Avatar of pamela rizk

ASKER

dear Duy
the content of teh editor is :"<p>sddsd</p>" & vbCrLf & "<p>sdsd<br />" & vbCrLf & "</p>"

HttpUtility.HtmlEncode(editor1.Content); = "&lt;p&gt;sddsd&lt;/p&gt;
&lt;p&gt;sdsd&lt;br /&gt;
&lt;/p&gt;"

textbox1.text ="&lt;p&gt;sddsd&lt;/p&gt;
&lt;p&gt;sdsd&lt;br /&gt;
&lt;/p&gt;' which is incorrect
ASKER CERTIFIED SOLUTION
Avatar of pamela rizk
pamela rizk
Flag of Lebanon image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
this is tested successfully