title: C# Button Click
body: <p>I have the following button on a .aspx page:</p>
  
  <pre><code>&lt;asp:Button runat="server" ID="bntLogin" OnClick="bntLogin_Click" Text="Login" /&gt;
  </code></pre>
  
  <p>With the following in the .aspx.cs:</p>
  
  <pre><code>protected void bntLogin_Click(object sender, EventArgs e)
          {
             //
          }
  </code></pre>
  
  <p>When I try to build it I get the following error:</p>
  
  <p>'ASP.reserve_aspx' does not contain a definition for 'bntLogin_Click' and no extension method 'bntLogin_Click' accepting a first argument of type 'ASP.reserve_aspx' could be found (are you missing a using directive or an assembly reference?)   </p>
  
  <p>However, when I move the click event from the code-behind to a script block inside the markup it builds.</p>
  
  <p>Any ideas?</p>