如何禁用验证要取消选中复选框控件时面板中的下拉菜单,并在检查时启用它 [英] How to disable validations To dropdowns which is in panel when my checkbox control is uncheck and it should enable when it is check

查看:82
本文介绍了如何禁用验证要取消选中复选框控件时面板中的下拉菜单,并在检查时启用它的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

实际上我想在取消选中我的复选框时禁用下拉列表的验证,并且当我的复选框被选中时它应该启用

Actually i want to disable validations to dropdown lists when my check box is unchecked and it should enable when my check box is checked

推荐答案

.cs site



ChkCapacity.Attributes.Add(OnClick,EnableDisableControl(this,''& ChkCapacity.ClientID&'','''& DDLCapacityKgs。 ClientID&''))





.cs site

ChkCapacity.Attributes.Add("OnClick", "EnableDisableControl(this,''" & ChkCapacity.ClientID & "'',''" & DDLCapacityKgs.ClientID & "'')")


function EnableDisableControl(source, Chk, ddl) {
    if (source.checked == false) {
        document.getElementById(ddl).selectedIndex = 0;
        document.getElementById(source.id.replace(Chk, ddl)).disabled = !source.checked;
    }
    else {
        document.getElementById(source.id.replace(Chk, ddl)).disabled = !source.checked;
        document.getElementById(ddl).focus();
    }
}


这篇关于如何禁用验证要取消选中复选框控件时面板中的下拉菜单,并在检查时启用它的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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