Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it possible to assign Multiple Validation Groups to a single Validation Control?

Tags:

I have a Form like this.

UserID has to be validated when user clicks "Check Availability" and "Submit"enter image description here

Hence "UserID" required field validator has to be assigned two grops.

As if now it is assigned only Group1

 <asp:RequiredFieldValidator ID="UserIDRequiredFieldValidator" runat="server" ErrorMessage="Enter UserID"
                    ControlToValidate="txtUserID" ValidationGroup="Group1"></asp:RequiredFieldValidator>

So is it possible to assign "Group1" and "Group2" to UserIDRequiredFieldValidator

I have already gone through How to validate against Multiple validation groups? which talks about validating Group1 and Group2 when user clicks "Submit" which is a good alternate solution .

Thanks in Advance

like image 656
Ananth Avatar asked Mar 14 '11 07:03

Ananth


People also ask

How many validation controls are there?

There are 6 types of validation controls available : RequiredFieldValidator. CompareValidator. RangeValidator.

How many validation controls are there in asp net just list them?

There are six validation controls available in ASP.NET Toolkit by default.

What is validation control how many types of validation control?

ASP.NET MVC 5 for Beginners ASP.NET provides the following validation controls: RequiredFieldValidator. RangeValidator. CompareValidator.

How do you use validation groups?

You create a validation group by setting the ValidationGroup property to the same name (a string) for all the controls you want to group. You can assign any name to a validation group, but you must use the same name for all members of the group.


1 Answers

What about using two RequiredFieldValidator objects, one for Group1 and one for Group2?

like image 134
Paolo Tedesco Avatar answered Sep 21 '22 16:09

Paolo Tedesco