如何在asp.net中使用多行限制文本框中的字符 [英] how to limit on characters in textbox with multiline in asp.net

查看:67
本文介绍了如何在asp.net中使用多行限制文本框中的字符的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何使用多行属性限制文本框的字符。我使用MaxLength

属性但不工作。给我一些想法或任何解决方案。我使用javascript吗?

解决方案

你不能使用maxLength属性直接执行此操作。

但是,Javascript可以帮助你实现 this [ ^ ]。


http://www.aspnet101.com/2009/01/limit-characters-in-multiline-textbox/ [ ^ ]正确答案


或者你可以直接在你的文本框标签中指定它。

 onkeypress =r eturn this.value.length< = 10//用你想要的最大长度替换10 





这完全适用于MaxLength。


How to limit characters of textbox with multiline property.I use MaxLength
property but not working.give me some idea or any solution.can I use javascript?

解决方案

You cannot do this directly using the maxLength property.
However, Javascript can help you achieve this[^].


http://www.aspnet101.com/2009/01/limit-characters-in-multiline-textbox/[^] for right answer


Alternatively you can directly specify this in your textbox tag.

onkeypress="return this.value.length<=10" //replace 10 with the max length you want



This exactly works as MaxLength.


这篇关于如何在asp.net中使用多行限制文本框中的字符的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆