Question

Im trying to disable RequiredFieldValidator on a button click but I cant seem to figure out how. I've also tried .Enabled property with no luck. This is what I have but its not working. Any help would be appreciated, thank you in advance

protected void btnCreateAccount_Click(object sender, EventArgs e)
{
    RequiredFieldValidator3.IsValid = false;
    RequiredFieldValidator4.IsValid = false;
    {
        lblCreateAccount.Text = user.CreateAccount();
    }
}
Was it helpful?

Solution

Set the control's CausesValidation property to false. it will disable validation for a specific control. [MSDN]

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top