I tried to display some text in Textbox(multiple lines) using ASP.NET. But I found that multi-line Textbox (textarea) is HTML encoded, meaning that when I want to display:
a >= b; & c
It will be automatically converted to:
a & gt;= b; & amp; c
which is NOT natural for people to read. So is there any way that I can disable this auto-HTML encoding behavior and just display it naturally in the Textbox?
If you are setting the text in the markup (.aspx), then what platon said is correct: .aspx is technically XML, so it has to conform to valid XML which means >
is encoded as >
, etc.
If you are setting the text in code-behind, (for example, textBox.Text = ""
) you could instead use an HtmlControls text area:
System.Web.UI.HtmlControls.HtmlTextArea textBox = new System.Web.UI.HtmlControls.HtmlTextArea();
textBox.Value = "a >= b; & c";