当文本框的模式设定为多行时,maxlength属性就无效了,这时可以使用RegularExpressionValidator控件,代码如下:

代码
<asp:TextBox ID="txtIntroduct" runat="server" TextMode="MultiLine"
     Height
="120px" Width="240px" class="input_text" />
<asp:RegularExpressionValidator ID="RegularExpressionValidator2" ControlToValidate="txtIntroduct"
     ValidationExpression
="([^.]|.){0,300}" runat="server" SetFocusOnError="true" Display="None"
     ValidationGroup
="AddApply" ErrorMessage="简单的介绍,300字以内!"></asp:RegularExpressionValidator>
<cc1:ValidatorCalloutExtender ID="ValidatorCalloutExtender11" HighlightCssClass="validatorCalloutHighlight"
     runat
="server" Enabled="True" TargetControlID="RegularExpressionValidator2">
</cc1:ValidatorCalloutExtender>

 

            

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-08-04
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-01-24
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案