使用jQuery的ASP.NET启用/禁用checkboxList [英] Asp.net enable/disable checkboxList with jQuery

查看:54
本文介绍了使用jQuery的ASP.NET启用/禁用checkboxList的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有这种结构:

单选按钮:

o启用o禁用

复选框

[] checkBox1

[]checkBox1

[] checkBox2

[]checkBox2

[] checkBox3

[]checkBox3

[] checkBox4

[]checkBox4

上述控件是动态生成的.

The Above controls are generated dynamically.

<asp:RadioButtonList runat="server" ID="rbSubsidiaries" onclick = "Radio_Click()"/>

 <asp:CheckBoxList runat="server" ID="cblSubsidiaries" Enabled="False"/>

我想要的是:当用户单击RadioButton时,启用所有复选框都启用,否则禁用.

What I want is: When the user click on the RadioButton Enable All the checkboxes get enable otherwise disable.

现在,我可以看到用户是否单击了启用单选按钮.

I am at the point where I can see that if the user has clicked on enable radio button.

 function Radio_Click() {
 if ($('#<%=rbSubsidiaries.ClientID %> input:checked').val() == 'enable') {
            alert('enable is clicked');
}
}

但是我不知道如何启用所有复选框.

But I don't know how to enable all the checkBoxes.

包含CheckBoxList的呈现结构的图片.前两个复选框.

Picture that Contains the the rendered structure of the CheckBoxList. First Two check Boxes.

推荐答案

尝试如下操作:

$("#cblSubsidiaries > input[type='checkbox']").prop("disabled", false)

更新:

$("#contentpage_0_content_0_cblSubsidiaries input[type=checkbox]").prop("disabled",false)

这篇关于使用jQuery的ASP.NET启用/禁用checkboxList的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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