Answer: No, isMaxLength doesn’t work with multiline textbox.
You need to handle such situation some other way. Javascript can be an option to deal with this situation.
You can use, following function to achieve the said functionality…
function isMaxLength(txtBox, length)
{
if(txtBox)
return (txtBox.value.length <= length-1);
}
Which can be used with multiline textbox as below…
<asp:TextBox ID="txtNotes" Width="92%" TextMode="MultiLine" Rows="6" runat="server" onkeypress='javascript:return isMaxLength(this,16);' ></asp:TextBox>
Asked In: Many Interviews |
Alert Moderator