Meir
Meir

Reputation: 12775

Bypassing a requiredfieldvalidator

I have a webform which has validators on it that work well when the user presses the submit button. But when the user presses the logout button the validators stop that button from working.

Any suggestions as to how remedy this?

Upvotes: 2

Views: 1795

Answers (3)

JustLoren
JustLoren

Reputation: 3234

Validation Groups shouldn't be needed. Instead, you need to specify on your buttons that they do not cause validation. This means you set the CausesValidation property to false.

At that point, that control's events won't trigger validation (client or server side).

Upvotes: 0

Matt Greer
Matt Greer

Reputation: 62057

You need to use the CausesValidation property on the button.

<asp:Button id="Button1" runat="server"
  Text="Cancel" CausesValidation="False">
</asp:Button>

Upvotes: 2

epitka
epitka

Reputation: 17657

Do you have ValidationGroup set up?

Upvotes: 0

Related Questions