如何使必需的字段验证器仅在控件验证可见时才能工作 [英] how to make required field validator to work only when control to validate is visible

查看:115
本文介绍了如何使必需的字段验证器仅在控件验证可见时才能工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道只有在目标控件的可见属性为true的情况下才能使所需的字段验证器起作用!可以使用启用"属性:

  .textInputValidator.Enable =  .txtInputData.Visible; 


您也可以在JavaScript中执行以下操作:

  var  hdnReqField = 文档 .getElementById(  hdnReqFieldValidator").value;
 var  ReqField = 文档 .getElementById(hdnReqField);

ValidatorEnable(ReqField, false ); // 用于禁用 



ValidatorEnable-是JavaScript中的内置函数.
传递"true"以启用验证器.

希望这会有所帮助.


I want to know how can we make required field validator to work only when the visible property of it''s target control is true !!

解决方案

You can use "Enable" property:

this.textInputValidator.Enable = this.txtInputData.Visible;


You can also do this in JavaScript as given below:

var hdnReqField = document.getElementById("hdnReqFieldValidator").value;
var ReqField = document.getElementById(hdnReqField);

ValidatorEnable(ReqField, false); //For Disabling



ValidatorEnable - is a inbuilt function in JavaScript.
Pass "true" for enabling the validator.

Hope this will help.


这篇关于如何使必需的字段验证器仅在控件验证可见时才能工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆