In this article I will explain how to trigger ASP.Net Validators like RequiredFieldValidators, RegularExpressionValidators, etc. of multiple groups using a single ASP.Net Button.
 
 
HTML Markup
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
</head>
<body>
    <form id="form1" runat="server">
        <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
        <asp:RequiredFieldValidator ID="RequiredFieldValidator1" ControlToValidate="TextBox1"
            ValidationGroup="Group1" runat="server" ErrorMessage="TextBox1 is required." />
        <br />
        <asp:TextBox ID="TextBox2" runat="server"></asp:TextBox>
        <asp:RequiredFieldValidator ID="RequiredFieldValidator2" ControlToValidate="TextBox2"
            ValidationGroup="Group2" runat="server" ErrorMessage="TextBox2 is required." />
        <br />
        <asp:TextBox ID="TextBox3" runat="server"></asp:TextBox>
        <asp:RequiredFieldValidator ID="RequiredFieldValidator3" ControlToValidate="TextBox3"
            ValidationGroup="Group3" runat="server" ErrorMessage="TextBox3 is required." />
        <br />
        <asp:Button ID="Button1" runat="server" Text="Button" OnClientClick="return Validate()" />
        <script type="text/javascript">
            function Validate() {
                var isValid = false;
                isValid = Page_ClientValidate('Group1');
                if (isValid) {
                    isValid = Page_ClientValidate('Group2');
                }
                if (isValid) {
                    isValid = Page_ClientValidate('Group3');
                }
                return isValid;
            }
        </script>
    </form>
</body>
</html>
 
 
Explanation
In the above HTML Markup I have.
1. Three ASP.Net Textboxes TextBox1, TextBox2, TextBox3.
2. Three ASP.Net RequiredFieldValidators RequiredFieldValidator1, RequiredFieldValidator2 and RequiredFieldValidator3 with three ValidationGroups Group1, Group2 and Group3 respectively.
3. And an ASP.Net Button Button1 on which we will trigger all the three Validation Groups together.
As we all know directly we can only specify one Validation Group for one Button, hence in order to call trigger multiple Validation Groups we will need to make use of JavaScript.
When the Button is clicked I call the JavaScript function Validate()which triggers all the three Validation Groups one by one using the ASP.Net inbuilt JavaScript function Page_ClientValidate('<Group Name>') function which accepts the Group Name as parameter and returns true if the validations are passed .
 
 
Demo
 
 
Downloads