I have a form where has a textbox with an htmlEditorExtender. It works. He can format his own content, or he can paste in entire webpages from elsewhere in the web. In source view, he sees the tags, and in regular view he sees the formatted text.
But...
I have another page where I want to let the user edit this text, if he wants to update it. Again, I use a textbox with an htmleditorextender.
The problem is, that when I get his original markup from a database and put it into the textbox, that original markup gets encoded. so for instance, a '<' character becomes <
I think this is a bug.
If a textbox has an htmleditorextender attached to it, then it should accept markup, and not try to encode it.
But since the problem exists, is there anyway, perhaps in the 'load' event of the textbox, to decode the text coming in?
Member
98 Points
141 Posts
using a htmleditorextender causes problems when you want to edit the text later.
Apr 20, 2014 04:46 PM|GIDLIBRARY|LINK
I have a form where has a textbox with an htmlEditorExtender. It works. He can format his own content, or he can paste in entire webpages from elsewhere in the web. In source view, he sees the tags, and in regular view he sees the formatted text.
But...
I have another page where I want to let the user edit this text, if he wants to update it. Again, I use a textbox with an htmleditorextender.
The problem is, that when I get his original markup from a database and put it into the textbox, that original markup gets encoded. so for instance, a '<' character becomes <
I think this is a bug.
If a textbox has an htmleditorextender attached to it, then it should accept markup, and not try to encode it.
But since the problem exists, is there anyway, perhaps in the 'load' event of the textbox, to decode the text coming in?
Thanks,
All-Star
15648 Points
2151 Posts
Re: using a htmleditorextender causes problems when you want to edit the text later.
Apr 21, 2014 05:22 AM|Happy Chen - MSFT|LINK
Workaround: When you get the text out of the editor, use HtmlDecode to convert it: String fixedText = HttpUtility.HtmlDecode(txtBody.Text);
please refer to the link for more information:
HtmlEditorExtender encoding HTML in postback when using LoadControl()
https://ajaxcontroltoolkit.codeplex.com/workitem/27170
https://ajaxcontroltoolkit.codeplex.com/SourceControl/latest#Server/AjaxControlToolkit/HtmlEditorExtender/HtmlEditorExtender.cs
Hope it helps you.
All-Star
48393 Points
12161 Posts
Re: using a htmleditorextender causes problems when you want to edit the text later.
Apr 22, 2014 12:29 AM|chetan.sarode|LINK
Refer this threads - http://forums.asp.net/t/1946311.aspx?HtmlEditorExtender+returning+encoded+HTML
http://forums.asp.net/t/1751476.aspx?Problem+reloading+html+text+to+htmleditorextender+and+keeping+html+format
Team Lead, Product Development
Approva Systems Pvt Ltd, Pune, India.