为什么maxLength不起作用 [英] Why maxLength is not working
问题描述
我使用内容页面。在下面的代码中,我想将字符限制为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 >
I use a content page. In the following code I want to limit the characters to 200. 这篇关于为什么maxLength不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
MaxLength
将无法使用 MutliLine textmod
e设置。
To处理这种情况需要构建一个带有 RegularExpressionValidator
的自定义验证方案。
一个例子是 ValidationExpression =^(\ w *)(\ * *)(。*){15}
< blockquote>(15将是长度)。
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 textmod
e 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).