Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics CRM (Archived)

Web Form -Script Manager error

Posted on by Microsoft Employee

Good Day,

Please advise on how to fix this Scriptmanager error '

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

I used the template within Visual studio to create ASPNet Web application. On one of the page I replaced the content with 

<asp:ScriptManager runat="server" />
<crm:CrmDataSource ID="Contacts" runat="server" />
<crm:CrmEntityFormView DataSourceID="Contacts" EntityName="contact" SavedQueryName="ContactForm" runat="server" />

.....But I want the contact Form to inherit design from the Master page, so I had a final code like this..........

<%@ Page Title="Home Page" Language="C#" MasterPageFile="~/Site.Master" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="CRMAPP._Default" %>

<asp:Content ID="BodyContent" ContentPlaceHolderID="MainContent" runat="server">

   <asp:ScriptManager runat="server" />
<crm:CrmDataSource ID="Contacts" runat="server" />
<crm:CrmEntityFormView DataSourceID="Contacts" EntityName="contact" SavedQueryName="Create Contact Web Form" runat="server" />

</asp:Content>

But I am now getting this 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.


Stack Trace: 

[InvalidOperationException: Only one instance of a ScriptManager can be added to the page.]
   System.Web.UI.ScriptManager.OnInit(EventArgs e) +600
   System.Web.UI.Control.InitRecursive(Control namingContainer) +139
   System.Web.UI.Control.InitRecursive(Control namingContainer) +312
   System.Web.UI.Control.InitRecursive(Control namingContainer) +312
   System.Web.UI.Control.InitRecursive(Control namingContainer) +312
   System.Web.UI.Control.InitRecursive(Control namingContainer) +312
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +408

*This post is locked for comments

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Web Form -Script Manager error

    It fixed the issue! Thanks.

  • Verified answer
    Nithya Gopinath Profile Picture
    Nithya Gopinath 17,074 on at
    RE: Web Form -Script Manager error

    Hi Samuel,

    Try removing ScriptManager from user control.

    See: stackoverflow.com/.../only-one-instance-of-a-scriptmanager-can-be-added-to-the-page-in-asp-net

    Only one instance of the ScriptManager control can be added to the page. The page can include the control directly, or indirectly inside a nested component such as a user control, content page for a master page, or nested master page. If a page already contains a ScriptManager control, but a nested or parent component needs additional features of the ScriptManager control, the component can include a ScriptManagerProxy control. For example, the ScriptManagerProxy control enables you to add scripts and services that are specific to nested components.

    Hope this helps.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,280 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,235 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans