How to suppress the effect of RequiredFieldValidator when clicking "Cancel" button?
Posted on 2006-03-29
I'm working on an ASP.NET web application. It is a web form that includes many web controls. Many of the TextBox have their own RequiredFieldValidators.
On this web page, there are 2 buttons: Submit and Cancel. I'd like to have the following effect: when clicking "Cancel", it is directed back to the homepage, e.g. index.html.
Assumed that the following scenario occurs: a user accesses this web page, e.g to register a profile. There is no data is entered at any textbox. The user now clicks on "Cancel" to go back to the home page.
However, the page is not directed back to the home page. Instead, red marks are placed beside all the empty textboxes - required to have inputs -. It seemed that the RequiredFieldValidators starts doing their jobs no matter what happens.
If you have any idea about how to suppress the effect of the RequiredFiledValidator when we need to cancel the process, please help.
Thanks a lot,