Last post Oct 29, 2013 01:55 AM by Happy Chen - MSFT
Oct 27, 2013 07:12 PM|iNSiPiD|LINK
I'm using multiple HtmlEditorExtenders in a DetailsView within a Web Form. My app targets .NET 4.5 and Entity Framework 5 and I have the sanitizer configured.
It's my understanding that the encoding/decoding is supposed to be autmagically managed.
But while I am able to correctly save the HTML data to the database, when I open the form for editing, the return text is being encoded.
As a test, I HTML decoded one of my fields on Page_Load as shown below.
TextBox MsgPrin = ((TextBox)AnnualReportsDetailsView.FindControl("TextBoxCurrPrim"));
MsgPrin.Text = Server.HtmlDecode(MsgPrin.ToString());
Miraculously, the HTML is now rendered correctly for ALL 6 fields in my page. This leads me to think there is a conflict or bug somewhere with the sanitisation.
Am I really expected to manage the encoding/decoding of every textbox control on my forms? What's the best way to manage this?
Oct 27, 2013 08:35 PM|oned_gk|LINK
Maybe you can set HtmlEncode to false
<asp:BoundField HtmlEncode="False" />
Oct 27, 2013 11:50 PM|chetan.sarode|LINK
Oct 29, 2013 01:55 AM|Happy Chen - MSFT|LINK
According to your description, i understand your issue is that encoded HTML and decoded HTML.
You can use custom method in your project to the encoding/decoding of every textbox control .
There are two files below those must be modified:
hope it helps you.