在multiline模式下限制textbox 的长度
当textbox的mode被设为multiline后,无法限制其可输入字符个数,可用regularvalidator来限制,规则设为: ^[/s/S]{0,25}$ ,其中可更改25为要限制的上限。
<asp:TextBox ID="TextBox1" runat="server" Text='<%# Bind("features") %>' MaxLength="15" TextMode="MultiLine" Columns="40" Rows="5" Wrap="true"></asp:TextBox>
<asp:RegularExpressionValidator ID="RegularExpressionValidator1" runat="server" ErrorMessage="maxlength to 200"
text="maxlength reach" controltovalidate="TextBox1" Display=dynamic ValidationExpression="^[/s/S]{0,25}$"
></asp:RegularExpressionValidator>