Reputation: 62213
I am using some of the built in Validator controls like the RequiredFieldValidator in my ASP.NET user controls. The default behavior when a validator fails is to show the error message and then disable the other server side controls on the page so the user is forced to correct their entry. I have other controls on the page, specifically a Telerik Rad tree view and some buttons, that I still want enabled and working on the page. Is there a way to change the behavior of the validators to only show their respective error messages and not interfere with the behavior of the other controls on the page/control? I am completely OK with the user still clicking the submit button as my server code will also handle the errors and as there are not going to be that many users using this site bandwidth is not an issue.
I have spent 30 minutes on Google searching for this answer but I am beginning to think that either no one wants this behavior or its so standard/widely known that no one bothered to ask it.
I am using .Net 4, ASP.NET, c#, visual studio 2010.
Thanks in advance! -Igor
Upvotes: 0
Views: 459
Reputation: 182
The control(e.g rad treeview) that you want to enable: just set its property as CausesValidation=false.
and after setting this property to that control(e.g rad treeview), you can overcome the validators.
Upvotes: 0
Reputation: 1153
Set the "ValidationGroup" property on the validator controls you want to check and the submit button on the form.
Only the validation controls with the same ValidationGroup as the button clicked will be validated when the form is submitted.
Upvotes: 1
Reputation: 1046
It sounds like you are looking to use validation groups so that only a portion of your controls are checked:
MSDN: Specifying Validation Groups
Also, if you want to allow a specific button control to remain functional regardless of the validators, you can set causesvalidation="False".
MSDN: Button.CausesValidation Property
Upvotes: 3