Hi,
<asp:textbox id="TextBox1" runat="server" maxlength="30" rows="3" textmode="MultiLine"></asp:textbox>
you're assumption is correct. It doesn't work. You can fix it with some script though. Take a look at some of theselinks.
The Maxlength attribute is known by theinput tag but is unavailable for thetextarea.
a TextBox control with textmode set to singleline is mapped on an input type="text" and one with the textmode set to multiline maps on a textarea. So this is, unfortunately, standard behavior.
Grz, Kris.
Wow, that was quick! :-)
Thanks for the links XIII
This is probably quickest way to do it, this limits it to 20 characters.
<asp:textbox id="txtText" runat="server" onkeyup="this.value = this.value.slice(0, 20)" rows="3" textmode="MultiLine"></asp:textbox>
Hi,
it's the first time I see this trick with the slice method. Very nice. Most of the "limiting characters scripts" require a lot more coding.
Just a side note, I always like to keep such functionality handy in some external .js file so I can reuse it throughout my site.
Something else I found and find quite annoying is that, when you want to use the arrow keys, the cursor always goes back to the last entered character.
Grz, Kris.
Hmm,
it seems to only happen in IE6 and not in firefox.
Grz, Kris.
0 comments:
Post a Comment