为什么maxLength不起作用 [英] Why maxLength is not working

查看:818
本文介绍了为什么maxLength不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用内容页面。在下面的代码中,我想将字符限制为200.

允许输入更多。如何限制它。



 <   asp:TextBox     ID   =  TBMessage    runat   = 服务器      OnTextChanged   =  TBMessage_TextChanged     AutoPostBack   = < span class =code-keyword> True    MaxLength   =  200  

style = z-index:1;上:485px;左:600px;位置:绝对;调整大小:无;身高:233px; width:400px

TextMode = MultiLine > < / asp:TextBox >

解决方案

多线的最大长度


MaxLength 将无法使用 MutliLine textmod e设置。

To处理这种情况需要构建一个带有 RegularExpressionValidator 的自定义验证方案。

一个例子是 ValidationExpression =^(\ w *)(\ * *)(。*){15}


< blockquote>
(15将是长度)。


I use a content page. In the following code I want to limit the characters to 200.
It is allowing to enter more than that. How to restrict it.

<asp:TextBox ID="TBMessage" runat="server"  OnTextChanged="TBMessage_TextChanged" AutoPostBack="True" MaxLength="200"

               style="z-index: 1; top: 485px; left: 600px; position: absolute; resize:none ; height: 233px; width: 400px"

               TextMode="MultiLine"></asp:TextBox>

解决方案

maxlength for multiline


MaxLength will not work with a MutliLine textmode setting.
To handle such scenarios a custom validation scenario with RegularExpressionValidator needs to be built.
An example would be ValidationExpression="^(\w*)(\s*)(.*){15}


" (15 would be length).


这篇关于为什么maxLength不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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