Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>The problem with CAbbott's answer is that validation errors that occur in the "parent" group will not be displayed after the call to validate the "child" group. The more minor problem with Oleg's answer is that validation of the "child" group will not occur until the "parent" group is ready.</p> <p>All we really need to do to allow client-side validation of more than one group at the same time is to override the Javascript IsValidationGroupMatch method which determines whether or not a control is to be included in the current set being validated.</p> <p>For example:</p> <pre><code>(function replaceValidationGroupMatch() { // If this is true, IsValidationGroupMatch doesn't exist - oddness is afoot! if (!IsValidationGroupMatch) throw "WHAT? IsValidationGroupmatch not found!"; // Replace ASP.net's IsValidationGroupMatch method with our own... IsValidationGroupMatch = function(control, validationGroup) { if (!validationGroup) return true; var controlGroup = ''; if (typeof(control.validationGroup) === 'string') controlGroup = control.validationGroup; // Deal with potential multiple space-delimited groups being validated var validatingGroups = validationGroup.split(' '); for (var i = 0; i &lt; validatingGroups.length; i++) { if (validatingGroups[i] === controlGroup) return true; } // Control's group not in any being validated, return false return false; }; } ()); // You can now validate against multiple groups at once, for example: // space-delimited list. This would validate against the Decline group: // // Page_ClientValidate('Decline'); // // while this would validate against the Decline, Open and Complete groups: // // Page_ClientValidate('Open Decline Complete'); // // so if you wanted to validate all three upon click of a button, you'd do: &lt;asp:Button ID="yourButton" runat="server" OnClick="ButtonSave_Click" CausesValidation="false" OnClientClick="return Page_ClientValidate('Open Decline Complete');" /&gt; </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload