I have a user control that contains a text box, an HtmlEditorExtender
, and a button. The user control is loaded into a parent page using LoadControl()
.
I was able to solve this problem like this :
Literal lit = new Literal();
lit.Mode = LiteralMode.PassThrough;
lit.Text = HttpUtility.HtmlDecode(HTMLTExt);
TextBox1.Text = lit.Text; // The text box which HTMLEditorExtender is attached to
Anyway I actually had a chance to test this and your problem was recreated. It looks as though putting your main page code that is in the "Load" event into the "Init" event it works just fine.
My understanding of the HTML extender is that the HTML tags are added based on the tools used on the toolbar. Have you tried loading the tb.text with:
"This is a test"
as opposed to
"< p >This is a test< /p >"
As to why it is doubling up on you like that, if the extender is adding the tags with every update then it seems as though they would(should) keep being added with every iteration.
...put the "p" tags around the textbox in markup
The response to this question seems to be a decent workaround. When you get the text out of the editor, use HtmlDecode
to convert it:
String fixedText = HttpUtility.HtmlDecode(txtBody.Text);
I'll go ahead and post this on your codeplex case also. (I assume it's yours.)