简体   繁体   中英

How to turn required field validator off when selecting cancel button

I have a problem where my page has a required field validator, but I also want to use a 'cancel' button which will take the user back to the menu page using response.redirect("default.aspx");

Problem is the field validator keeps firing when you click the cancel button. How do you turn this off so the user can return to the menu page?

只需将CausesValidation="false"添加到您的按钮定义中,它将不会引发任何验证器:

<asp:Button ID="btnCancel" runat="server" Text="Cancel" CausesValidation="false" />

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM