Search code examples
asp.netajaxscriptmanager

how to clear error


How to clear the following error:

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.

The following is my html Markup:

<%@ Page Language="C#" AutoEventWireup="true" MasterPageFile="~/MasterPage.master"   
    CodeFile="ManualReport.aspx.cs" Inherits="ManualReport" %>
<%@ Register assembly="Telerik.Web.UI" namespace="Telerik.Web.UI" 
    tagprefix="telerik" %>

<asp:Content  ContentPlaceHolderID="ContentPlaceHolder1" runat="server" 
    ID="ContentPlaceHolder1">

<%@ Register Assembly="Microsoft.ReportViewer.WebForms, Version=9.0.0.0, 
    Culture=neutral,   PublicKeyToken=b03f5f7f11d50a3a"
    Namespace="Microsoft.Reporting.WebForms" TagPrefix="rsweb" %>

<form id="mainform" runat="server"><table width="100%" >
    <asp:ScriptManager ID="ScriptManager2" runat="server">
    </asp:ScriptManager>

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

</form>

    <div>
         <tr><td>Customer Name</td><td>
        <asp:RadioButton ID="rdbcustomerAll" runat="server"  Visible ="false"   
 GroupName="CustomerValidation" 
                 Text="All" Checked="false" /></td><td>
             <asp:RadioButton ID="rdbcustomerSpecific" runat="server"  
  GroupName="CustomerValidation" Visible="false" Text="Spec" Checked="true" /></td></
  td><td>
                     <asp:DropDownList ID="cmbName" runat="server">
                     </asp:DropDownList></td></tr>
                     <tr><td>Date</td><td><asp:RadioButton ID="rdbDateAll" runat="server" 
  Visible ="false" GroupName="DateValidation" 
                 Text="All"  /></td><td>
             <asp:RadioButton ID="rdbDateSpec" runat="server" Visible ="false" Checked="true" GroupName="DateValidation" Text="Spec" /></td><td>
        <telerik:RadDatePicker ID="rdpDate" runat="server" xmlns:telerik="telerik.web.ui">
                              </telerik:RadDatePicker>
                     </td></tr>

Solution

  • Why did you add the ScriptManager two times on your page? You can only add one, and that's what the error says. Only one ScriptManager instance is allowed per page.

    Please remove the ScriptManager2 and it will work for you.

    Secondly ScriptManger should be under Form Tag. like..

    <form id="mainform" runat="server"><table width="100%" >
    
      <asp:ScriptManager ID="ScriptManager1" runat="server">
      </asp:ScriptManager>
    
    </form>