"控制' ContentPlaceHolder1_txtReason'类型' TextBox'必须放在带有runat = server的表单标记内。"}

时间:2016-12-14 07:59:29

标签: asp.net

我是asp.net的初学者。我一直收到上述错误

  

Control' ContentPlaceHolder1_txtReason'类型' TextBox'必须放在带有runat = server的表单标记内。"}

而且我无法解决它头上的问题。

希望有人可以指出我的错误。

   <%@ Master Language="C#" AutoEventWireup="true"     CodeBehind="Master.master.cs" Inherits="E.Master" %>
<!DOCTYPE html>
 <head id="Head1" runat="server">
     <asp:ContentPlaceHolder ID="head" runat="server">
</asp:ContentPlaceHolder>   
</head>
<body>          

    <!-- Navigation -->
    <nav class="navbar navbar-default navbar-static-top" role="navigation"  style="margin-bottom: 0">
        <div class="navbar-header">
            This navbar
            <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
                <span class="sr-only">Toggle navigation</span>
                <span class="icon-bar">aaaaaaa</span>
                <span class="icon-bar">aaaaaaa</span>
                <span class="icon-bar">aaaaaaaa</span>
            </button>
                    </div>
        <!-- /.navbar-header -->
        <ul class="nav navbar-top-links navbar-right">               
        </ul>
        <!-- /.navbar-top-links -->
    </div>
        </nav>
    <div class="navbar-default sidebar" role="navigation">
        <div class="sidebar-nav navbar-collapse">
            <% generateMenu(); %>
        </div>
    </div>    
          <div id="page-wrapper">

        <asp:ContentPlaceHolder ID="ContentPlaceHolder1" runat="server">
        </asp:ContentPlaceHolder>
        <asp:ContentPlaceHolder ID="footercontent" runat="server">
        </asp:ContentPlaceHolder>

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

1 个答案:

答案 0 :(得分:0)

您应该放置<form runat="server" id="form1">

 <body>          
    <form id="form1" runat="server">
       // You should code for your controls inside this block. This runat="server" indicates that a control is being treated as a server control.
        </form>
    </body>

更多详情为Here