我想知道是否可以在Ajax Toolkit CascadingDropDon加载上创建JavaScript / jQuery事件。
情景:
我在第一个下拉列表中选择项目 - >第二个下拉列表加载了Ajax Toolkit级联下拉功能 - >作为对此的反应,我的JavaScript函数会触发。
答案 0 :(得分:2)
做到了!
这是一种方法:
在CascadinDropDown声明中,我添加了BehaviourID:
<cc1:CascadingDropDown
ID="CascadingDDL"
TargetControlID="childDDL"
ParentControlID="parentDDL"
Category="ddl"
PromptText="Select"
ServicePath="~/webmethods.asmx"
runat="server" **BehaviorID="cddBehaviourID"**
ServiceMethod="GetValuesForDDL" Enabled="True">
</cc1:CascadingDropDown>
在剧本中:
function pageLoad(sender, args) { //For Ajax toolkit to fire on 'window.onload'
var behavior = $find('<%=CascadingDDL.BehaviurID %>');
if (behavior != null) {
behavior.add_populated(function() { *what you want to execute* });
}
}