Let us start with our example code. For this example code I have two text box one is for the user name and the second one is for the user password, I have only one required field validator for the user name, So that you can understand what the problem is. Next I have three button control for three different scenarios,
2- Sign In: It only has the server side validator and will be fire when you press this sign in button.
Let me discuss this example in three steps
Step 1 (Server Side Validators):
Step 2 (Server Side Validator And Client Side Validation):
Step 3 (Page.Validate And Page.IsValid):
When this method is invoked, it iterates through the validation controls contained in the ValidatorCollection object associated with the Page.Validators property and invokes the validation logic for each validation control in the current validation group. The validation group is determined by the control that posted the page to the server. If no validation group is specified, then no validation group is used.
So by using the Page.Validate and Page.IsValid property we solved our problem of catching the validity of the server side validators.You can download the source code from here.
All and any comments / bugs / suggestions are welcomed!