Page.Isvalid always returns false?

I have two buttons and two separate validation groups for each button. I saved EnableClientScript=false for each required text field authentication field. I have C # code as below

 void submitButton_Click(object sender, EventArgs e) { this.Page.Validate("LoginAccountGroup"); if (this.Page.IsValid) { } } void saveButton_Click(object sender, EventArgs e) { this.Page.Validate("CreateAccountGroup"); if (Page.IsValid) { } } 

My question is that Page.Isvalid always returns false in C # code. How to make it work

+4
source share
1 answer

try it

 protected bool IsGroupValid(string sValidationGroup) { Page.Validate(sValidationGroup); foreach (BaseValidator validator in Page.GetValidators(sValidationGroup)) { if (!validator.IsValid) { return false; } } return true; } 
0
source

All Articles