且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何为多行TextBox的最大长度?

更新时间:2023-12-04 13:41:04

如果您希望让用户知道他是否超出字符作为他写道,你可以使用JavaScript函数连接到关键preSS事件的金额。该功能将测试输入的长度和取消字符渲染,如果maxlenght达到。

If you want to let the user know if he exceeded the amount of characters as he writes, you could use a javascript function attached to keypress event. This function would test the length of the input and cancel the character rendering if the maxlenght was reached.

另一种选择是使用 RegularEx pressionValidator 控件来验证上提交的投入。

Another option is to use RegularExpressionValidator control to validate the input on submit.

在我看来,第一个选项是好过得多。

In my opinion, the first option is much more better.

我不加入任何code,因为谷歌是充满了各种口味的例子,这是一个很常见的任务。

I'm not adding any code since google is full of examples for all tastes, this is a very common task.

Here你有一个示例搜索可能的帮助。

Here you have a sample search that might help.