[英]asp.net error creating control
i just opened my asp.net solution and am getting this message on every control on my application!我刚刚打开我的 asp.net 解决方案,我在我的应用程序的每个控件上都收到了这条消息!
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?有谁知道我做错了什么?
It's just happened to me. 这件事发生在我身上。 It happened when I renamed page and moved aspx file within project folders, but code inside left unrenamed.
它发生在我重命名页面并在项目文件夹中移动aspx文件,但左边的代码未透明。
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: 并且还要将Page标签中的Inherits属性编辑为:
Inherits="Newfoldername_renamedname"
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. 您可以通过执行以下步骤来解决此错误,此错误的根本原因是Web应用程序项目与IIS中的虚拟目录之间的映射不正确。
To Resolve this error , follow the following steps: 要解决此错误,请执行以下步骤:
1-Right click - you web application project and select Properties -> Web 1 - 右键单击 - 您的Web应用程序项目,然后选择属性 - > Web
2- in the server section choose Use IIS Web Server -> then click Create Virtual. 2-在服务器部分中选择“使用IIS Web服务器” - >然后单击“创建虚拟”。
3- Clean your project and compile again. 3-清理项目并重新编译。
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 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 http://blogs.msdn.com/b/webdevtools/archive/2010/05/06/another-error-creating-control-in-the-design-view-with-object-reference-not-set-in-视觉工作室2010.aspx
Closed the aspx designer, cleaned the project and rebuild it, everything started working perfectly. 关闭aspx设计器,清理项目并重建它,一切都开始完美。 (using Visual Studio 2015)
(使用Visual Studio 2015)
I had the same problem with all my pages.我的所有页面都遇到了同样的问题。 I changed the version of .NETFramework and it worked.
我更改了 .NETFramework 的版本并且它起作用了。 The version of .NETFramework at the time when components were added was different from the current version.
添加组件时.NETFramework 的版本与当前版本不同。
I had the same problem and I tried all of the above but none of them worked for me.我遇到了同样的问题,我尝试了以上所有方法,但没有一个对我有用。
What did work was the following: Go to Project->Properties click on Web and then change the Server (mine was defined as Local IIS) to External IIS and Save.起作用的是以下内容:Go 到项目-> 属性单击 Web,然后将服务器(我的服务器定义为本地 IIS)更改为外部 IIS 并保存。
I didn't even have to restart VS and the controls re-appeared correctly.我什至不必重新启动 VS,并且控件重新正确显示。
Once you get your controls to appear properly, you can change your Web->Server settings back to what they were before.一旦您的控件正确显示,您可以将 Web->Server 设置更改回它们之前的状态。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.