开发者

Bypassing a requiredfieldvalidator

开发者 https://www.devze.com 2023-01-01 17:23 出处:网络
I have a webform which has validators on it that work well when the开发者_Python百科 user presses the submit button. But when the user presses the logout button the validators stop that button from wo

I have a webform which has validators on it that work well when the开发者_Python百科 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?


You need to use the CausesValidation property on the button.

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


Do you have ValidationGroup set up?


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).

0

精彩评论

暂无评论...
验证码 换一张
取 消