【问题标题】:Telerik RadControl: Can't find control using suggested methodTelerik RadControl:使用建议的方法找不到控件
【发布时间】:2015-10-14 09:44:41
【问题描述】:

我正在尝试解决一个烦人的问题。 根据 Telerik 的说法,我应该能够从客户端找到我的控制权。

var combo = $find(controls.cboDevicesClientID);
console.log("cbo device: " + combo);

我的班级给出了控制权

function init(servicesFramework, controlsSettings, moduleSettings, resourcesSettings, args) {

        sf = servicesFramework;
        controls = controlsSettings;
        settings = moduleSettings;
        resources = resourcesSettings;
        params = args;

        $("input:radio").click(function () {
            setMode($(this).val());
        });
    }

在我的 .ascx 中,我的类是使用这种方式调用的。

$(document).ready(function () {

        mgModule.DmeWizard.init(
            <%= ModuleId %>,
            $.ServicesFramework(<%= ModuleId %>), 
            // Controls
            {
                scopeWrapperId: '<%= ScopeWrapper.ClientID %>',
                cboDevicesClientID: '<%= cboDevices.ClientID %>'
            },
            // Settings
            {
            },
            // Resources
            {
            }
        );
    });

我的设备上的 console.log 总是为空,我不明白为什么。

【问题讨论】:

    标签: jquery asp.net telerik


    【解决方案1】:

    确保在 Sys.Application.Load 之后调用 $find(),因为在早期阶段 IScriptControls 未初始化,它将返回 null:http://msdn.microsoft.com/en-us/library/bb383829.aspx

    这是一个例子:

                Sys.Application.add_load(function () {
                    var combo = $find(controls.cboDevicesClientID);
                    console.log("cbo device: " + combo);
                });
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2011-11-07
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-11-24
      • 1970-01-01
      • 1970-01-01
      • 2023-03-31
      相关资源
      最近更新 更多