Reputation: 11299
I have a page with the following code on it:
<script type="text/javascript" language="javascript">
/// <reference name="MicrosoftAjax.js" />
Sys.WebForms.PageRequestManager.getInstance().add_endRequest(EndRequestHandler);
function EndRequestHandler(sender, args)
{
ToggleTimeDiv();
}
</script>
When the page loads I get the following error:
I'm using Visual Studio 2008 Standard Edition. What is causing this error?
Upvotes: 17
Views: 62814
Reputation: 1065
Do you have
<asp:ScriptManager ID="ScriptManager1" runat="server">
</asp:ScriptManager>
at the top of your page.. I had same problem.. added this and it works...
Upvotes: 6
Reputation: 100577
If you're using ASP.NET routing, use this line in your global.asax
void Application_Start(object sender, EventArgs e)
{
RouteTable.Routes.Ignore("{resource}.axd");
}
Upvotes: 1
Reputation: 71
You should place your script code at the end of your page, after all your content but just before the end tag. between end form tag and end body tag Here’s the code you need, in its rightful place:
<html>
...
</head>
<body>
<form id="form1" runat="server">
...
</form>
enter code here
<script type="text/javascript" language="javascript">
/// <reference name="MicrosoftAjax.js" />
Sys.WebForms.PageRequestManager.getInstance().add_endRequest(EndRequestHandler);
function EndRequestHandler(sender, args)
{
ToggleTimeDiv();
}
</script>
</body>
</html>
Upvotes: 7