Utiliser l'attribut MaxLength dans une TextBox Multiligne avec du JavaScript
La TextBox multiligne :
<asp:TextBox runat="server" ID="txtMulti" Width="100%" Rows="7" TextMode="MultiLine" Style="resize: none;" OnKeyPress="CaracMax(this, 10)" MaxLength="10" />
La fonction JavaScript :
function CaracMax(texte, max) { if (texte.value.length >= max) { texte.value = texte.value.substr(0, max - 1); } }