Hello Samir,
Nope, it won't work. You'll have to write some JavaScript to limit the number
of characters in textarea. You should count the number of characters in the
textarea onchange event, and truncate whatever is over the number of characters
you want to limit to.
> Hi
> I am using Textarea type.I want to set maximum length to the textarea.
[quoted text clipped - 7 lines]
> Help me in the same
> Samir (S.E INDIA).
abtcabe - 09 Dec 2004 19:23 GMT
I concur, the MaxLength event does not work for a textarea.
However, you can also use the keypress event in JavaScript. See the
following ex:
<script language="javascript">
function maxSize(intMaxSize)
{
if (Form1.txtCoverCopy.value.length < intMaxSize)
{
return true;
}
else
{
return false;
}
}
</script>
<asp:TextBox id="txtCoverCopy" runat="server" Width="768px"
TextMode="MultiLine" Height="38px" onkeypress="return
maxSize(10)"></asp:TextBox>
> Hello Samir,
>
[quoted text clipped - 14 lines]
> > Help me in the same
> > Samir (S.E INDIA).
Mythran - 14 Dec 2004 18:07 GMT
>I concur, the MaxLength event does not work for a textarea.
>
[quoted text clipped - 16 lines]
>
> </script>
<textarea onkeypress="javascript:return (this.value.length < 10);">
should work too :P
Mythran