繁体   English   中英

ASP.NET服务器控件显示超出上下文消息

[英]ASP.NET Server Controls Showing Out Of Context Msg

我正在使用这个简单的网页,碰巧用一些东西来纠正我的页面样式,突然回到.cs文件中的编程时,事情很奇怪。 所有代码都显示类似的错误信息:

错误2当前上下文中不存在名称“TextBox1”d:\\ ADO_NETprojects \\ mywebsite \\ Default2.aspx.cs

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default2.aspx.cs"     `enter code here`Inherits="Default2" %>

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

    <div>
    <asp:ListBox ID="ListBox1" runat="server" AutoPostBack="True" 
        onselectedindexchanged="ListBox1_SelectedIndexChanged" Width="179px"     style="margin-left:100px; margin-bottom:20px;">
    </asp:ListBox>
     </div>

     <hr/>
     <div>
     ListBoxItems 
     <asp:TextBox ID="TextBox1" runat="server"  style="margin-left:20px; margin-top:20px;"></asp:TextBox>
     </div>

     <div>
     <asp:Button ID="Button1" runat="server" onclick="Button1_Click" 
        style="height: 26px; margin-left:100px; margin-top:15px;" Text="ListsBoxItems"  />
     </div>
     <hr/>


     <div>
     DeleteItems:
     <asp:TextBox ID="TextBox2" runat="server" style="margin-top:10px; margin-     left:25px;"></asp:TextBox>
     </div>
     <hr/>

     <div>
     <asp:DropDownList ID="DropDownList1" runat="server" 
             style="margin-top:20px; margin-left:100px; width:200px;" 
            AutoPostBack="True"      onselectedindexchanged="DropDownList1_SelectedIndexChanged">
     </asp:DropDownList>
     </div>

     <div>
     DropDownList:
     <asp:TextBox ID="TextBox3" runat="server" style="margin-left:2px; margin-top:15px;" 
            AutoPostBack="True"></asp:TextBox>
     </div>
     <hr/>


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

右键单击aspx文件,然后选择“转换为Web应用程序”,然后重新生成designer.cs文件

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM