July 18, 2012

Microsoft JScript runtime error: AjaxControlToolkit requires ASP.NET Ajax 4.0 scripts. Ensure the correct version of the scripts are referenced. If you are using an ASP.NET ScriptManager, switch to the AjaxScriptManager in System.Web.Ajax.dll, or use the ToolkitScriptManager in AjaxControlToolkit.dll.



I believe there are many other problems which can cause this symptom, but in my case, as the error message says, the solution is that you need to include the “ToolkitScriptManager” rather than the standard “ScriptManager”

To add the ToolkitScriptManager, you first need to include the assembly namespace on your aspx page.

<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit"
TagPrefix="asp" %>
If you control is right on your main page, chances are you have already done this.  But in my case the Ajax control was embedded in a user control, so I didn’t have it on the main page yet.

Then you can simply include the manager by changing the standard script manager

<asp:ScriptManager ID="scriptMaster" runat="server"></asp:ScriptManager>
to this:

<asp:ToolkitScriptManager ID="toolkitScriptMaster" runat="server">
</asp:ToolkitScriptManager>

No comments:

Post a Comment