【问题标题】:Disable textbox required field validator control禁用文本框必填字段验证器控件
【发布时间】:2021-01-12 05:23:23
【问题描述】:

我想根据变量的某些条件禁用文本框的必填字段验证器控件:

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

这里需要什么代码?

【问题讨论】:

  • 你的问题有你的答案

标签: c# asp.net


【解决方案1】:
if(var == null)
{
  requirefieldvalidator1.Enabled = true;
}
else
{
  requirefieldvalidator1.Enabled = false;
}

【讨论】:

    猜你喜欢
    • 2015-02-20
    • 2011-07-16
    • 1970-01-01
    • 1970-01-01
    • 2017-01-08
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多