【问题标题】:Microsoft JScript runtime error: Object expectedMicrosoft JScript 运行时错误:预期对象
【发布时间】:2011-03-25 08:51:26
【问题描述】:

当以下条件匹配时我收到此错误,我在内容页面中使用以下代码,在我的母版页中我有这个

<asp:ScriptManager EnablePartialRendering="true" EnablePageMethods="true" ID="smgr" runat="server" />

错误:Microsoft JScript 运行时错误:预期对象

 if (lstRecipient.Items[i].Text == ddlRecipient.SelectedItem.Text)
 {
   lstRecipient.Items.RemoveAt(i);
   isDuplicate = true;
   ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "AlertAdd", "jAlert('Recipient name is already in the list.', 'Duplicate Entry!');", true);
 }

【问题讨论】:

标签: c# asp.net scriptmanager


【解决方案1】:

这通常是在无法解析 jscript 函数时引起的。你有对包含 jAlert 函数的 JQuery 库的引用吗?

【讨论】:

  • 我的母版页中有这个。
  • @Nisar Khan - 您能否确认该库正在使用 Firebug 之类的工具进行加载?路径正确吗?如果您将代码更改为 Javascript 警报,会发生什么情况?它现在有效吗?正在生成的脚本块是什么样的?一些可以尝试的想法。
  • 我的脚本在“”中,我将这些脚本移到 部分,现在它可以工作了。
猜你喜欢
  • 1970-01-01
  • 2011-02-24
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多