开发者

Ignore requiredvalidator in logout

Afternoon all.

Here's an easy one for you that I can't figure out.

I have a requiredfield validator that is doing its job too well! Upon the lnkLogOut, the user should be logged out but the requiredfield validator is preventing this.

protected void lnkLogOut_Click(object sender, EventArgs e)
        {
            Session.Abandon();
            Response.Write("<script language='javascript'> { window.close();}</script>");
        }

How do I go about essentially voiding the required field validator in this instance i.e. the user may go into the page, realise this is not the way forward, does not touc开发者_如何学Pythonh the controls (so they are still empty) but the required validator is ignored.

Apologies for the thick question.


You may set CausesValidation to False on that control, like so:

<asp:Link runat="server" ID="lnkLogout" CausesValidation="False" ... />

You may also like to review ValidationGroups, to indicate the certain controls should only validate certain groups of input fields, etc.


Use the validation group property:

http://msdn.microsoft.com/en-us/library/ms227424.aspx

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜