2011-06-04 42 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。

戴夫