简体   繁体   English

单击按钮禁用RequiredFieldValidator

[英]Disable RequiredFieldValidator on a button click

Im trying to disable RequiredFieldValidator on a button click but I cant seem to figure out how. 我试图在单击按钮时禁用RequiredFieldValidator,但似乎无法弄清楚。 I've also tried .Enabled property with no luck. 我也尝试过.Enabled属性,但没有运气。 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();
    }
}

Set the control's CausesValidation property to false. 将控件的CausesValidation属性设置为false。 it will disable validation for a specific control. 它将禁用特定控件的验证。 [MSDN] [MSDN]

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM