0
問候;使用jquery啓用/禁用CascadingDropDown
我有asp.net dropdownlist控件與Ajax CascadingDropDown控件。
我也有我的asp.net複選框控件。我想啓用/禁用CascadingDropDown當複選框選中/取消選中使用jQuery。
我嘗試了不同的方式,但他們沒有工作,如果我想將dropdownlist的啓用屬性設置爲false,它將無法工作,因此我必須將CascadingDropDown啓用屬性設置爲false以禁用它,但我不知道如何。
這是我試過的代碼之一:
<asp:CheckBox ID="chkWF" runat="server" onclick="enableDDL"/>
<asp:DropDownList ID="WF" runat="server"></asp:DropDownList>
<cc1:CascadingDropDown ID="WF_CascadingDropDown" runat="server"
TargetControlID="WF"
Category="WF"
LoadingText="Please Wait ..."
PromptText="Select Work Field ..."
ServiceMethod="GetWorkField"
ServicePath="../ServiceTags.asmx" Enabled="True">
</cc1:CascadingDropDown>
function enableDDL() {
$('#<%= chkOccup.ClientID %>').click(function() {
if ($('#<%= WF_CascadingDropDown.ClientID %>').attr('disabled') != true)
$('#<%= WF_CascadingDropDown.ClientID %>').attr('disabled', true);
else
$('#<%= WF_CascadingDropDown.ClientID %>').attr('disabled', false);
});
}