We tried several ways to make a textbox to accept the \"enter\", newline, etc.. But we are still facing the same problems. Most of the \"Third party\" controls allow the use
To avoid this problem and allow HTML tags in TextBox control you need to change ValidateRequest of Page directive to false. You can do it like in code bellow:
use ValidateRequest="false"
Set the mode to TextBoxMode.MultiLine
Either in the code-behind,
myTextBox.TextMode = TextBoxMode.MultiLine
or in the markup
<asp:TextBox TextMode="MultiLine"
When the user enters text in the TextBox, it will come back to you with new lines as \r\n
. If you'd like to display it properly to the user, you could use
myTextBox.Text.Replace(Environment.NewLine, "<br />")