Powered by Blogger.

Friday, February 14, 2014

Only one instance of a ScriptManager can be added to the page in Ajax



Recently while working with Ajax control toolkit, I faced the below error message.

Only one instance of a ScriptManager can be added to the page.

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.InvalidOperationException: Only one instance of a ScriptManager can be added to the page.

Source Error: 
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

Also you can check out some of the previous posts on:

- How to create drop down menu for login and signup using jQuery in asp.net ?

- Extension method in MVC

- Steps to create wcf service and host wcf service as windows service in C#.Net

Reason:
There should be one Script manager in a page.

Solution:
Actually I put one Script manager in the master page and while adding Ajax Control Toolkit I added another script manager in the page itself.

<asp:ScriptManager ID="ScriptManager1" runat="server"></asp:ScriptManager>

<asp:ToolkitScriptManager ID="ToolkitScriptManager1" runat="Server" />

So the above error came. The solution is I remove one script manager from the page.