MaxLength property

collie

New member
MaxLength property

Good morning. I have a problem with my textbox server control. I set it to multiline and maxlength 250 but it doesn't receive the maxlength. I have other single-line textboxes that also have a maxlength and they work. only the multiline textbox doesn't work. What could be the reason? Thanks Doesn't work: <TD dir="rtl" vAlign="middle" align="right"> <asp:TextBox id="txtComments" tabIndex="5" runat="server" Height="72px" TextMode="MultiLine" MaxLength="250"></asp:TextBox></TD> This works: <TD dir="rtl" align="right"><asp:textbox id="txtCreditNumber" tabIndex="11" runat="server" Width="153px" MaxLength="19"></asp:textbox></TD>​
 

gilad g

New member
Hmmm

When asp.net encounters a multi-line textbox, it actually converts it into a HTML <textarea> element (and not <input type=text>). The textarea doesn't have a maxlength property, and that's why it doesn't work. You can, however, limit the size of a textarea from script. Start by looking here -> http://www.asp.org.il/articles/js_textarea.asp
 
למעלה