Reputation: 17
I want to disable required validator field for a specific button click which is not check only a textbox. i've tried this code in the button click but not worked. so need this type of code how solve.
protected void Button3_Click(object sender, EventArgs e)
{
if (TextBox1 == null)
{
RequiredFieldValidator1.EnableViewState = false;
}
}
Upvotes: 1
Views: 2581
Reputation: 73
RequiredFieldValidator61.Visible = false;
is what worked for me. It disables the error massage.
Upvotes: 0
Reputation: 836
Just set CausesValidation="false"
on your button property.
If you wish to validate that particular button with some other TextBox or control you can set ValidationGroup="groupA"
to those controls and name it same group.
Upvotes: 1