Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

asp.net error creating control

Tags:

c#

asp.net

i just opened my asp.net solution and am getting this message on every control on my application!

here is my code:

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

does anyone know what i am doing wrong?

like image 835
Alex Gordon Avatar asked Sep 06 '11 23:09

Alex Gordon


3 Answers

It's just happened to me. It happened when I renamed page and moved aspx file within project folders, but code inside left unrenamed.

Change code inside from:

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

to current

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

And also edit Inherits property in Page tag to:

Inherits="Newfoldername_renamedname"
like image 189
Anonymous Avatar answered Nov 09 '22 21:11

Anonymous


You can resolve this error by following the below steps , the root cause of this error is the incorrect mapping between web application project and the virtual directory in your IIS.

To Resolve this error , follow the following steps:

1-Right click - you web application project and select Properties -> Web

2- in the server section choose Use IIS Web Server -> then click Create Virtual.

3- Clean your project and compile again.

done :)

This info is on following site.

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

Here is another article which proposed different solution and cause there is that object is not initialized before use.

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

like image 36
Adnan Bhatti Avatar answered Nov 09 '22 21:11

Adnan Bhatti


Closed the aspx designer, cleaned the project and rebuild it, everything started working perfectly. (using Visual Studio 2015)

like image 25
Dany Gauthier Avatar answered Nov 09 '22 21:11

Dany Gauthier