How do I stop HtmlEditorExtender encoding html in postback?

本小妞迷上赌 提交于 2019-12-01 21:27:08
Matthew Lowe

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.)

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

JohnM

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.

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
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!