作为向导的第一步,我有许多文本框。
所有这些文本框都有一个 requiredfieldvalidator。
我需要找到一种方法来绕过这些验证或暂时忽略它们,因为我需要在向导结束时显示所有错误,作为单击完成之前的最后一步。
我遇到的问题是,在填写完所有文本框之前,向导不允许我导航到下一步。
有没有办法我可以忽略错误并在我的向导中导航并在我的向导结束时在验证摘要中使用它们?
这是我的 asp 代码:(我尝试将每个文本框的 CausesValidation 设置为 false,但这仍然不起作用)
<asp:WizardStep ID="WizardStep1" runat="server" Title="Step 1 - Customer Information">
<asp:Table runat="server" ID="UserInfoTable">
<asp:TableRow>
<asp:TableCell>
<asp:Label ID="Label2" runat="server" Text="Identification Number:"></asp:Label>  
</asp:TableCell>
<asp:TableCell>
<asp:TextBox runat="server" ID="txtUserID" CausesValidation="false"></asp:TextBox>
<asp:RequiredFieldValidator runat="server" ID="RequiredFieldValidator" ErrorMessage="*Required" ControlToValidate="txtUserID"></asp:RequiredFieldValidator><br />
</asp:TableCell>
</asp:TableRow>
<asp:TableRow>
<asp:TableCell>
<asp:Label ID="Label1" runat="server" Text="First Name:" CausesValidation="false"></asp:Label>  
</asp:TableCell>
<asp:TableCell>
<asp:TextBox runat="server" ID="txtUserFName" CausesValidation="false"></asp:TextBox>
<asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ErrorMessage="*Required" ControlToValidate="txtUserFName"></asp:RequiredFieldValidator><br />
</asp:TableCell>
</asp:TableRow>
<asp:TableRow>
<asp:TableCell>
<asp:Label ID="Label3" runat="server" Text="Second Name:" CausesValidation="false"></asp:Label>  
</asp:TableCell>
<asp:TableCell>
<asp:TextBox runat="server" ID="txtUserSurname"></asp:TextBox>
<asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server" ErrorMessage="*Required" ControlToValidate="txtUserSurname"></asp:RequiredFieldValidator><br />
</asp:TableCell>
</asp:TableRow>
<asp:TableRow>
<asp:TableCell>
<asp:Label ID="Label4" runat="server" Text="Street Addrress:" CausesValidation="false"></asp:Label>  
</asp:TableCell>
<asp:TableCell>
<asp:TextBox runat="server" ID="txtUserAddress" CausesValidation="false"></asp:TextBox>
<asp:RequiredFieldValidator ID="RequiredFieldValidator3" runat="server" ErrorMessage="*Required" ControlToValidate="txtUserAddress"></asp:RequiredFieldValidator><br />
</asp:TableCell>
</asp:TableRow>
<asp:TableRow>
<asp:TableCell>
<asp:Label ID="Label5" runat="server" Text="City:" CausesValidation="false"></asp:Label>  
</asp:TableCell>
<asp:TableCell>
<asp:TextBox runat="server" ID="txtUserCity"></asp:TextBox>
<asp:RequiredFieldValidator ID="RequiredFieldValidator4" runat="server" ErrorMessage="*Required" ControlToValidate="txtUserCity"></asp:RequiredFieldValidator><br />
</asp:TableCell>
</asp:TableRow>
<asp:TableRow>
<asp:TableCell>
<asp:Label ID="Label6" runat="server" Text="E-Mail:" CausesValidation="false"></asp:Label>  
</asp:TableCell>
<asp:TableCell>
<asp:TextBox runat="server" ID="txtUserEmail"></asp:TextBox>
<asp:RegularExpressionValidator ID="RegularExpressionValidator1" runat="server" ErrorMessage="*Email address incorrect" ControlToValidate="txtUserEmail" ValidationExpression=".+@.+"></asp:RegularExpressionValidator><br />
</asp:TableCell>
</asp:TableRow>
<asp:TableRow>
<asp:TableCell>
<asp:Label ID="Label7" runat="server" Text="Contact Number:" CausesValidation="false"></asp:Label>  
</asp:TableCell>
<asp:TableCell>
<asp:TextBox runat="server" ID="txtContactNo"></asp:TextBox>
<asp:RequiredFieldValidator ID="RequiredFieldValidator5" runat="server" ErrorMessage="*Required" ControlToValidate="txtContactNo"></asp:RequiredFieldValidator>
<br />
</asp:TableCell>
</asp:TableRow>
</asp:Table>
</asp:WizardStep>
我知道如何使用验证摘要。所以我不需要帮助。我只需要知道如何禁用控件上的验证。
谢谢您的帮助。