2011-06-04 67 views
0

如何清除以下错误:如何清除错误

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.

以下是我的HTML标记:

<%@ 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> 
+0

你有一个严重的问题,构建您的ASPX标记。这超出了'ScriptManager'重复的问题。我相信你需要阅读一些关于asp.net的教程。其中很多... – 2011-06-04 06:25:11

回答

0

为什么您在页面上添加ScriptManager两次?你只能添加一个,这就是错误所说的。每个页面只允许有一个ScriptManager实例。

请删除ScriptManager2它会为你工作。

其次ScriptManger应该在表单标签下。像..

<form id="mainform" runat="server"><table width="100%" > 

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

</form> 
+0

@Muhammad Akhtar我删除了一个脚本管理器,发生了同样的问题 – Malliga 2011-06-04 05:41:16

+0

您删除了哪一个? ScriptManager2应该被移除,因为这是在表单标签之外。 – 2011-06-04 05:43:48

+0

@Muhammad Akhtar我已经删除了ScriptManager2,这是一个相同的问题如何清除 – Malliga 2011-06-04 05:45:36

0

你必须在页面具有两个脚本经理:

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

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

根据错误的描述,您必须删除一个。你可能只有一个。

+0

我已经删除了一个脚本管理器,发生了同样的问题 – Malliga 2011-06-04 05:43:07

+0

我们需要看到更多。错误消息是相当公然的。 – Khepri 2011-06-04 05:50:35

1

ScriptManager是一个服务器端组件和它必须放置在form标记内。每页只能添加一个ScriptManager组件。在你的情况下,你提供了两个ScriptManager组件。因此,您必须删除其中的一个,即位于form之外的ScriptManager

从答案其他人已经放弃,这是100%正确
0

除此之外,你也关闭你的“形式”太早...

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

使封闭“形式”标签后,所有你的服务器端ASP.NET控件,确保你的HTML保持有效...(很难确切地知道在哪里看不到你的完整标记,但我猜接近结束内容标记:/ asp:Content)

编辑:实际上,还值得指出的是,因为您在此处使用母版页,您可能已经在母版页中拥有了服务器端表单...您无法然后在aspx子页面中也有第二种形式。我建议可以把你的单一脚本管理器放到你的母版页,在表单标签中,像其他人指出的一样,并从脚本管理器中删除所有引用,并从子页面(aspx)中删除“表单”)?

HTH。

戴夫