2012-07-30 72 views
1

我在asp.net中使用中繼器,並在嘗試調試時不斷收到此錯誤。我已經在這個應用程序中有多箇中繼器,這些中繼器都可以正常工作,沒有任何問題。當我將這個添加到頁面的頂部時,出現此錯誤。當我擺脫數據綁定部分時,錯誤不會顯示。我確實有一個在C#中設置了正確名稱的方法。中繼器上的ItemDataBound上的錯誤

Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately.

Compiler Error Message: CS1061: 'ASP.default_aspx' does not contain a definition for 'rptCert_ItemDataBound' and no extension method 'rptCert_ItemDataBound' accepting a first argument of type 'ASP.default_aspx' could be found (are you missing a using directive or an assembly reference?)

源錯誤:

Line 55: 
Line 56:   <b>Certifications</b><br /> 
Line 57:   <asp:Repeater ID="rptCert" runat="server" 
Line 58:    onitemdatabound="rptCert_ItemDataBound"> 
Line 59:    <HeaderTemplate> 



<asp:Repeater ID="rptCert" runat="server" OnItemDataBound="rptCert_ItemDataBound"> 
     <HeaderTemplate> 
      <table> 
       <tr> 
        <td width="200px"></td> 
        <td width="30px"></td> 
       </tr> 
     </HeaderTemplate> 
     <ItemTemplate> 
      <tr> 
       <td> 
        <asp:Label runat="server" ID="lblAcct"></asp:Label> 
       </td> 
       <td> 
        <asp:TextBox runat="server" ID="txtCert"></asp:TextBox> 
       </td> 
      </tr> 
     </ItemTemplate> 
     <FooterTemplate> 
      </table> 
     </FooterTemplate> 
    </asp:Repeater> 
+0

你編譯了你的web應用程序嗎?你的方法是否有正確的參數類型? – podiluska 2012-07-30 17:55:50

+0

您是否曾經將頁面背後的default.aspx代碼複製到新文件中? – 2012-07-30 18:31:44

+0

@JoelEtherton這不可能。該代碼位於default.aspx.cs頁面,其中所有其他方法可用,如果我在後端刪除了'onitemdatabound =「rptCert_ItemDataBound」'部分 – agrk12 2012-07-30 18:44:04

回答

0

您需要定義rptCert_ItemDataBound

您是否刪除了後面的代碼或不包含該函數的功能 - 也許你有一個錯誤,它不編譯?


因爲你的頭這樣說:

Inherits="Interaction_Experience_Update._Default" 

Inherits="Interaction_Experience_Update._Default"對象必須有與此模板的功能:

void rptCert_ItemDataBound(Object Sender, RepeaterItemEventArgs e) 
    {} 
+0

我有這個'protected void rptCert_ItemDataBound(object sender,RepeaterItemEventArgs e) {}' – agrk12 2012-07-30 17:57:55

+0

以及運行時鏈接程序沒有找到它。 – Hogan 2012-07-30 17:58:24

+0

它編譯了嗎?我希望它是'對象發件人...'因爲C#中的關鍵問題很重要 – Hogan 2012-07-30 18:01:04

0

我叫我的一個朋友在我的手機和他說我認爲我陷入了一個無限循環。我通過右鍵單擊屏幕右下角的圖標來停止ASP.NET Developer Server。停止後,它開始正常運行。提取數據並敲擊事件代碼。