title: Can't add button to aspx page
body: <p>I tried the following code to the Webform.aspx page:</p>
  
  <pre><code> &lt;asp:Button ID="btnShowAssignLecturer" runat="server" 
          onclick="btnShowAssignLecturer_Click" Text="Assign Lecturer To Room" /&gt;
  </code></pre>
  
  <p>It says: System.Web.HttpException: Control 'ctl00_head_btnShowAssignLecturer' of type 'Button' must be placed inside a form tag with runat=server. </p>
  
  <p>When I do that, I get another error. Not quite sure what to do.</p>
  
  <p>Master page code:</p>
  
  <pre><code>&lt;%@ Master Language="C#" AutoEventWireup="true" CodeBehind="MasterPage.master.cs" Inherits="AllsWellHospital.Front_End.MasterPage" %&gt;
  
  &lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt;
  
  &lt;html xmlns="http://www.w3.org/1999/xhtml"&gt;
  &lt;head runat="server"&gt;
      &lt;h1&gt;All Wells Hospital&lt;/h1&gt;
        &lt;p&gt;
        &lt;asp:Label ID="DateDisplay" runat="server"&gt;&lt;/asp:Label&gt;
        &lt;/p&gt;
      &lt;asp:ContentPlaceHolder ID="head" runat="server"&gt;&lt;/asp:ContentPlaceHolder&gt;   
      &lt;link id="Link1" href="/Styles/StyleSheet2.css" runat="server" rel="stylesheet" type="text/css"/&gt;
      &lt;style&gt;
      body
      {
       background-color:#d0e4fe;   
      }
      &lt;/style&gt;
  
  &lt;/head&gt;
  &lt;body&gt;
      &lt;form id="form1" runat="server"&gt;    
       &lt;div id="topContent"&gt;
       &lt;asp:Menu ID="NavigationMenu" runat="server" CssClass="menu" EnableViewState="false" IncludeStyleBlock="false" Orientation="Horizontal"&gt;
               &lt;Items&gt;
        &lt;asp:MenuItem NavigateUrl="WebForm1.aspx" Text="Web form.aspx"  Value="Upload SP10"&gt;&lt;/asp:MenuItem&gt;
               &lt;/Items&gt;
              &lt;/asp:Menu&gt;
      &lt;/div&gt;
  
  
  
  
      &lt;/form&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>Webform.aspx code:</p>
  
  <pre><code>&lt;%@ Page Title="" Language="C#" MasterPageFile="~/Front_End/MasterPage.Master" AutoEventWireup="true" CodeBehind="WebForm1.aspx.cs" Inherits="AllsWellHospital.Front_End.WebForm1" %&gt;
  &lt;asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server"&gt;
  
   &lt;asp:Label ID="Label1" runat="server" Font-Bold="True" Font-Size="Medium" 
          Text="Course Report"&gt;&lt;/asp:Label&gt;
  
           &lt;asp:Button ID="btnShowAssignLecturer" runat="server" 
          onclick="btnShowAssignLecturer_Click" Text="Assign Lecturer To Room" /&gt;
  
  &lt;/asp:Content&gt;
  </code></pre>