TextBox中TextMode为MuiltLine时如何设置最大长度

TextBox中TextMode为MuiltLine时如何设置最大长度,第1张

TextBox当TextMode为MultiLine时MaxLength是不生效的。

设置一个TextBox时,在多行,你可以使用如下所示的RegularExpressionValidator控制Maxength

[c-sharp] view plain copy print?

<asp:TextBox ID="txtConclusion" MaxLength="200" TextMode="MultiLine" Height="100px" Width="400px" runat="server" />

<asp:RegularExpressionValidator ID="txtConclusionValidator1" ControlToValidate="txtConclusion" Text="超过200字" ValidationExpression="^[/s/S]{0,200}$" runat="server" />

不是vs2010的问题,也不光是ie,还有很多浏览器不支持的。因为TextMode除了 multiLine singleline password 外,其它都非通用的。有的浏览器支持,有的不支持。所以不建议用这三个以外的属性。

当然你可以通过js实现,推荐使用DatePicker


欢迎分享,转载请注明来源:内存溢出

原文地址: https://outofmemory.cn/tougao/11208392.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2023-05-14
下一篇 2023-05-14

发表评论

登录后才能评论

评论列表(0条)

保存