简体   繁体   English

ASP.NET AJAX PageLoad事件未触发

[英]ASP.NET AJAX PageLoad event not firing

I inherited some code that uses ASP.NET AJAX pageLoad client side event. 我继承了一些使用ASP.NET AJAX pageLoad客户端事件的代码。 The code runs fine and the method is called when the page is opened in the server in an URL such as http://localhost/IISApp/page.aspx , but when I open it in the server with URL http://ServerName/IISApp/page.aspx , the pageLoad is not called. 代码在服务器上以http://localhost/IISApp/page.aspx之类的URL在服务器中打开时,代码运行正常,并且在使用URL http:// ServerName /在服务器中将其打开时,调用了该方法。 IISApp / page.aspx ,未调用pageLoad。

Any idea on what may be causing the behavior? 对可能导致该行为的原因有任何想法吗? This happens in Firefox and IE. 在Firefox和IE中会发生这种情况。

Update: The pageLoad is in a separate file, and is declared as 更新:pageLoad在单独的文件中,并声明为

function pageLoad(sender, args)
{
   ....
}

This file is included in the master page as: 该文件在母版页中的显示方式为:

<asp:ScriptReference Path="~/js/functions.js" />

It's running is IIS7, there are no special configurations in IIS for when a user hits the site with server name or localhost. 它运行的是IIS7,当用户使用服务器名称或本地主机访问站点时,IIS中没有特殊配置。 If I run it from VS 2010 (Cassini web server), the method is also not being called. 如果我从VS 2010(Cassini Web服务器)运行它,该方法也不会被调用。

Thx in advance 提前Thx

You need to add a script manager to your aspx page, or you can add the following script to the page head 您需要将脚本管理器添加到aspx页面,或者可以将以下脚本添加到页面标题

document.body.onload=pageLoad;

regards 问候

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM