我的 asp.net 页面上有 3 个过滤器文本框。每个文本框都分配有 2 个正则表达式验证器,1 个用于数字,1 个用于 alpha。它正确检测到验证,但是当我按下搜索按钮时,即使出现验证工具提示(显示过滤器无效),它仍会回发。有什么想法为什么它“忽略”验证并无论如何发回?这是我对 3 个控件及其验证的定义。
<td>
<asp:TextBox ID="txtAcctFilter" runat="server" BackColor="#FF6600" TabIndex="1">Enter Account No</asp:TextBox>
<asp:RegularExpressionValidator ID="revAcctFilter" runat="server" Text="*" ControlToValidate="txtAcctFilter"
ToolTip="Enter Valid Account" ValidationExpression="^\d*$" ValidationGroup="Numeric"></asp:RegularExpressionValidator>
<asp:RegularExpressionValidator ID="revAcctFilter2" runat="server" ControlToValidate="txtAcctFilter"
ValidationExpression="^Enter Account No$" ValidationGroup="Alpha"></asp:RegularExpressionValidator>
</td>
<td>
<asp:TextBox ID="txtYearFilter" runat="server" BackColor="#FF6600" TabIndex="2"> Enter Year</asp:TextBox>
<asp:RegularExpressionValidator ID="RevYearFilter" runat="server" Text="*" ControlToValidate="txtYearFilter"
ToolTip="Enter Valid Year" ValidationExpression="^20\d{2}$" ValidationGroup="Numeric"></asp:RegularExpressionValidator>
<asp:RegularExpressionValidator ID="RevYearFilter2" runat="server" ControlToValidate="txtYearFilter"
ValidationExpression="^Enter Year$" ValidationGroup="Alpha"></asp:RegularExpressionValidator>
</td>
<td>
<asp:TextBox ID="txtMonthFilter" runat="server" BackColor="#FF6600" TabIndex="3">Enter Month</asp:TextBox>
<asp:RegularExpressionValidator ID="RevMonthFilter" runat="server" Text="*" ControlToValidate="txtMonthFilter"
ToolTip="Enter Valid Month" ValidationExpression="^(1[0-2]|0?[1-9])$" ValidationGroup="Numeric"></asp:RegularExpressionValidator>
<asp:RegularExpressionValidator ID="RevMonthFilter2" runat="server" ControlToValidate="txtMonthFilter"
ValidationExpression="^Enter Month$" ValidationGroup="Alpha"></asp:RegularExpressionValidator>
</td>