【问题标题】:Ajax Toolkit CascadingDropDown onload event?Ajax Toolkit CascadingDropDown onload 事件?
【发布时间】:2012-01-16 16:45:14
【问题描述】:

我想知道这是否可以在 Ajax Toolkit CascadingDropDon 加载时创建一个 JavaScript/jQuery 事件。

场景:

我在第一个下拉列表中选择项目 -> 第二个下拉列表加载了 Ajax Toolkit 级联下拉功能 -> 作为对此我的 JavaScript 函数触发的反应。

【问题讨论】:

    标签: javascript .net ajax toolkit


    【解决方案1】:

    做到了!

    这是一个方法:

    在 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* });
    
          }
    }
    

    【讨论】:

    • 伙计,很高兴我找到了这个。在某些情况下,需要将选项项添加到由 CascadingDrowpDown 控制的下拉列表。在我阅读这篇文章之前无法弄清楚。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-07-08
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多