2

I have a c# asp.net registration form , but i'm unable to use the reset button to achieve the objective I want. Upon clicking the reset button, the validators I have demand that I fill up ALL textboxes before I can reset the fields.

If a user were to fill up half of the form and use the reset fields, the reset button does not achieve the objective I want it to, as all textboxes have to be filled.

The codes I'm using are as follows:

protected void resetButton_Click(object sender, EventArgs e)
{Response.Redirect(Registration.aspx);}
1

3 Answers 3

5

Since this looks like Asp.Net Web Forms, as opposed to MVC, On the aspx file where you set up the button, set the CausesValidation property to false. Link: http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.button.causesvalidation(v=vs.110).aspx

Example:

<asp:Button CausesValidation="False" />
Sign up to request clarification or add additional context in comments.

Comments

4

Add this to the server-side handler of the reset button:

Response.Redirect("~/Registration.aspx", true);

Comments

0

you can clear the modelstate on the controller. ModelState.Clear();

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.