locked
ScriptManager error with master page RRS feed

  • Question

  • 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

    Tuesday, April 11, 2017 5:45 PM

All replies

  • Hi there,

    You have posted your question in the wrong forum. Post it in the ASP.Net forum.

    https://forums.asp.net/

    Thanks


    Sachith Chandrasiri

    Tuesday, April 11, 2017 10:50 PM