I have a question and I'm not sure what the best tact is for this.
I have a TextArea input on a page. This textarea has a maxsize of 500 characters.
<asp:TextBox ID="TxtOther" Width="530px" TextMode="MultiLine" Style="word-wrap: break-word;
height: 300px; overflow: auto; vertical-align: top" runat="server" AutoComplete="off" MaxLength="500" />
Now, the bad thing is on the code-behind it will take the text entered and do a Server.HtmlEncode of of.
The situation is this (for example): the user can enter like 499 characters in the textarea and that that includes a "<" sign. Obviously, the < when encoded with have the <. That puts the length of the text entered greater than 500.
How can I have the code on the client-side encode the text entered to validate that it's still less than 500 after the encoding? I am willing to just truncate whatever is over 500 characters.
What are the best approaches?