Reputation: 73
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
Reputation: 471
Set the control's CausesValidation property to false. it will disable validation for a specific control. [MSDN]
Upvotes: 4