【发布时间】:2012-11-14 18:50:16
【问题描述】:
这是创建 javascript 对象的函数
public IEnumerable<ScriptDescriptor>
GetScriptDescriptors()
{
ScriptControlDescriptor descriptor = new ScriptControlDescriptor("HierarchyPathControl.PathExplorer", this.ClientID);
descriptor.AddProperty("some_property", "some_value");
yield return descriptor;
}
这是 .js 文件的一部分
Type.registerNamespace("HierarchyPathControl");
HierarchyPathControl.PathExplorer = function (element) {
HierarchyPathControl.PathExplorer.initializeBase(this, [element]);
alert("invoked");
}
HierarchyPathControl.PathExplorer.prototype = {
initialize: function () {
HierarchyPathControl.PathExplorer.callBaseMethod(this, 'initialize');
alert("not invoked");
},
..............................
为什么只有当我删除此行时才会调用第二个警报:
descriptor.AddProperty("some_property", "some_value");
谢谢。
【问题讨论】:
-
您是否看到任何 javascript 错误?
标签: javascript asp.net asp.net-ajax custom-server-controls