我正在使用 3 个验证器来验证 TextBox,但是当在 Textbox 中输入无效值时都会触发所有验证器。但是我希望这些验证器以特定的顺序工作,以便用户可以一一解决这些故障。
<asp:TextBox ID="txt_temp" runat="server"></asp:TextBox>
<asp:CompareValidator ID="cv_txt_temp" runat="server" CssClass="error" ControlToValidate="txt_temp" ValueToCompare="0" Type="Double" Operator="GreaterThanEqual" ValidationGroup="insert" SetFocusOnError="true" ErrorMessage="Must be valid value" Display="Dynamic"></asp:CompareValidator>
<asp:RegularExpressionValidator ID="rev_txt_temp" CssClass="error" SetFocusOnError="true"
runat="server" ErrorMessage="Value upto 1 decimal place" Display="Dynamic" ControlToValidate="txt_temp" ValidationExpression="\d+(?:(?:\.|,)\d{0,1})?" ValidationGroup="insert"></asp:RegularExpressionValidator>
<asp:RangeValidator ID="rv_txt_temp" Display="Dynamic" runat="server" SetFocusOnError="true" ValidationGroup="insert" ControlToValidate="txt_temp" Type="Double" CssClass="error"></asp:RangeValidator>