user3236592
user3236592

Reputation: 73

Disable RequiredFieldValidator on a button click

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();
    }
}

Upvotes: 0

Views: 8424

Answers (1)

Raju Melveetilpurayil
Raju Melveetilpurayil

Reputation: 471

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

Upvotes: 4

Related Questions