views:

39

answers:

2

Greetings,
I use ASP.NET validation control and I want to reset them whenever the user click on a button "Create new stuff button as an example" and I don't want to set it to an empty error message.
How can this be done in?

+1  A: 

You need to add

 CausesValidation="false"

as an attribute to any button that you do not want to validate the page.

Philip Smith
+1  A: 

Use Validation groups. Very Important so that controls dont interfere with each other. To set the Message, use the 'errormessage' attribute.

Here's an example of a proper Validation Control

<asp:requiredfieldvalidator id="RequiredFieldValidator1"
  controltovalidate="NameTextBox"
  validationgroup="PersonalInfoGroup"
  errormessage="Enter your name."
  runat="Server">
</asp:requiredfieldvalidator>

Read more on this MSDN article

Fox