开发者

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:ScriptMana开发者_如何学Pythonger 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>


ScriptManager is a server side component and it has to be placed inside a form tag. Only one ScriptManager component must be added per page. In your case, you have provided two ScriptManager components. Therefor, you have to remove one of them, the ScriptManager which resides outside the form.


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>


You have two script managers in the page:

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

and

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

Per the description of the error, you have to remove one. You may only have one.


Aside from the answers the others have already give, which are 100% correct, you are also closing your "form" too early...

<form id="mainform" runat="server"></form>

Move the closing "form" tag to AFTER all your Server side ASP.NET controls, ensuring your HTML remains valid... (difficult to know exactly where to without seeing your full markup, but I would guess close to the closing Content tag : /asp:Content)

EDIT: Actually, also worth pointing out that because you are using a master page here, you probably already have a server side form inside your master page... You cannot then have a second form inside the aspx child page aswell. I would suggest maybe putting your Single Script manager into your master page, inside the form tag, as the others have pointed out, and removing all references to script manager and "form" from the child (aspx) page) ?

HTH.

Dave

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜