c# - asp.net 创建控件时出错

标签 c# 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>

谁知道我做错了什么?

最佳答案

这只是发生在我身上。当我重命名页面并在项目文件夹中移动 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)
    {
    }
}

并且还将 Page 标记中的 Inherits 属性编辑为:

Inherits="Newfoldername_renamedname"

关于c# - asp.net 创建控件时出错,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7327275/

相关文章:

asp.net - 创建友好 URL 时如何删除无效字符(即如何创建 slug)?

asp.net - 捕获 ASP.NET UserControls 中未处理的异常

javascript - 如何替换 VS2010 javascript 文件

c# - 如何将 Windows Phone 8.1 应用程序部署到 Windows 10 移动设备?

C# 使用流

具有固定数组大小的 C# ToArray()

c# - 从俄罗斯网站读取 XML 时的编码问题

asp.net - CSS 副本不起作用

c# - Excel 包 : Office Open XML

c# - 当我使用它时,我的 IF 属性在我的类(class)中被忽略了