2011-09-06 68 views
7

我剛打開我的asp.net解決方案,並在我的應用程序的每個控件上獲取此消息!asp.net錯誤創建控件

這裏是我的代碼:

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WebForm1.aspx.cs" Inherits="EnterData.DataEntry.WebForm1" %> 

<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="asp" %> 

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 

<html xmlns="http://www.w3.org/1999/xhtml" > 
<head runat="server"> 
    <title></title> 
</head> 
<body> 
    <form id="form1" runat="server"> 
    <div> 
    <asp:ScriptManager ID="ScriptManager1" runat="server" /> 


     <br /><table> 
       <tr> 
       <td> 
       lom_number: 
       </td> 
       <td><asp:TextBox ID="lom_numberTextBox" runat="server" 
        Text=''/></td> 

       <td>occurrence_date:</td> 
       <td><asp:TextBox ID="occurrence_dateTextBox" runat="server" 
        Text='<%# Bind("occurrence_date") %>' /> 

        <asp:MaskedEditExtender ID="MaskedEditExtender1" 
    TargetControlID="occurrence_dateTextBox" 
    Mask="99/99/9999" 
    MessageValidatorTip="true" 
    OnFocusCssClass="MaskedEditFocus" 
    OnInvalidCssClass="MaskedEditError" 
    MaskType="Date" 
    InputDirection="RightToLeft" 
    AcceptNegative="Left" 
    DisplayMoney="Left" 
    ErrorTooltipEnabled="True" runat="server"/></td> 
       <td>report_date:</td> 
       <td><asp:TextBox ID="report_dateTextBox" runat="server" 
        Text='<%# Bind("report_date") %>' /></td> 
        <td>spec_id:</td> 
       <td><asp:TextBox ID="spec_idTextBox" runat="server" Text='<%# Bind("spec_id") %>' /></td>    
        </tr> 
       <tr> 


       <td>batch_id:</td> 
       <td><asp:TextBox ID="batch_idTextBox" runat="server" 
        Text='<%# Bind("batch_id") %>' /></td> 
       <td>report_by:</td> 
       <td> 
       <asp:TextBox ID="report_byTextBox" runat="server" 
        Text='<%# Bind("report_by") %>' /></td> 

       <td>identified_by:</td> 


       <td><asp:TextBox ID="identified_byTextBox" runat="server" 
        Text='<%# Bind("identified_by") %>' /></td> 
       <td>problem:</td> 
       <td><asp:TextBox ID="problemTextBox" runat="server" Text='<%# Bind("problem") %>' /></td> 
       <td></td> 
       </tr></table> 
       <table><tr><td>section_c_issue_error_identified_by:</td> 
       <td> 
       <asp:TextBox ID="section_c_issue_error_identified_byTextBox" width="500" runat="server" 
        Text='<%# Bind("section_c_issue_error_identified_by") %>' /> 
        </td></tr> 
       <tr><td>section_c_comments:</td><td><asp:TextBox ID="section_c_commentsTextBox" Width="500" runat="server" 
        Text='<%# Bind("section_c_comments") %>' /></td></tr> 
       <tr><td>section_d_investigation:</td><td> 
       <asp:TextBox ID="section_d_investigationTextBox" runat="server" 
        Text='<%# Bind("section_d_investigation") %>' /></td></tr> 
       <tr><td>section_e_corrective_action:</td> <td><asp:TextBox ID="section_e_corrective_actionTextBox" runat="server" 
        Text='<%# Bind("section_e_corrective_action") %>' /></td></tr> 
       <tr><td>section_f_comments:</td><td><asp:TextBox ID="section_f_commentsTextBox" runat="server" 
        Text='<%# Bind("section_f_comments") %>' /></td></tr> 


       </table> 
     <asp:Button ID="Button1" runat="server" Text="Button" OnClick="SubmitData" /> 

    </div> 
    </form> 
</body> 
</html> 

沒有人知道我在做什麼錯?

+0

在設計模式中,ToolTip在錯誤中說了什麼? –

+0

@ shredder沒有工具提示它 –

+0

污穢和謊言! –

回答

3

這只是發生在我身上。當我重命名頁面並將項目文件夾中的aspx文件移動時,發生了這種情況,但代碼在左側未命名。

更改代碼中的:

public partial class foldername_unrenamedname : System.Web.UI.Page 
{ 
    protected void Page_Load(object sender, EventArgs e) 
    { 
    } 
} 

當前

public partial class newfoldername_renamedname : System.Web.UI.Page 
{ 
    protected void Page_Load(object sender, EventArgs e) 
    { 
    } 
} 

而且也在頁面標籤編輯繼承財產:

Inherits="Newfoldername_renamedname" 
2

您可以通過執行以下步驟來解決此錯誤,此錯誤的根本原因是Web應用程序項目和IIS中的虛擬目錄之間的映射不正確。

要解決此錯誤,請按照下列步驟操作:

1 - 右鍵 - 你的Web應用程序項目,並選擇屬性 - >網絡

2-在服務器部分選擇使用IIS Web服務器 - >然後單擊創建虛擬。

3-清理項目並重新編譯。

done :)

此信息是在以下網站上。

http://weblogs.asp.net/hosamkamel/archive/2007/09/15/resolving-error-creating-control-xxx-in-web-application-project.aspx

下面是其中提出不同的解決方案,並導致有使用前沒有初始化該對象的另一篇文章。

http://blogs.msdn.com/b/webdevtools/archive/2010/05/06/another-error-creating-control-in-the-design-view-with-object-reference-not-set-in-visual-studio-2010.aspx

+0

這不起作用 –

+0

請幫助我不知道如何解決這個問題 –

0

關閉ASPX設計師,清理項目並重建它,一切都開始完美。 (使用Visual Studio 2015)