I have a Form like this.
UserID has to be validated when user clicks "Check Availability" and "Submit"
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
There are 6 types of validation controls available : RequiredFieldValidator. CompareValidator. RangeValidator.
There are six validation controls available in ASP.NET Toolkit by default.
ASP.NET MVC 5 for Beginners ASP.NET provides the following validation controls: RequiredFieldValidator. RangeValidator. CompareValidator.
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.
What about using two RequiredFieldValidator objects, one for Group1 and one for Group2?
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With