简体   繁体   English

禁用文本框必需的字段验证器控件

[英]Disable textbox required field validator control

I want to disable the requiredfield validator control for the textbox based on some condition of a variable:我想根据变量的某些条件禁用文本框的 requiredfield 验证器控件:

if(var==null)
{
    //Activate it
}
else
{
    //disable it
}

What code do I need here?我在这里需要什么代码?

if(var == null)
{
  requirefieldvalidator1.Enabled = true;
}
else
{
  requirefieldvalidator1.Enabled = false;
}

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

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