I have cause validation true on button. And I am checking the Page.IsValid
in c# code. But its always returning false value?
Here is a code snippet that helped me debug my issue:
foreach (BaseValidator validator in Page.Validators)
{
if (validator.Enabled && !validator.IsValid)
{
// Put a breakpoint here
string clientID = validator.ClientID;
}
}
I know it might be too late but: Did you have a hidden validator?
I know its too late, Hope some one will benefit
If you have Requiredfieldvalidators in webpage, you need to set validataiongroup attribute to the each RequiredValidator.
And then in code you've to check
Page.Validate("validategroupname");
if(!Page.IsValid()){
// your code
}
this solves issue
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