title: SharePoint 2013 web part button click event not firing
body: <p>I am building my first Hello World Web part using the Cloud 9 videos as tutorial.</p>
  
  <p>I am using an Azure VM with SharePoint 2013, SQL Server 2012 and VS Premium 2013 Update 4.</p>
  
  <p>The Web part is a simple textbox with a button and a label. The click event triggers a method which sets the text of the label to "Hello, " + the text from the textbox.</p>
  
  <pre><code>    protected void btnSubmitThis_Click(object sender, EventArgs e)
      {
          lblOutput.Text = "Hello, " + txtTextBox.Text;
      }
  </code></pre>
  
  <p>I have been able to push my Web part and insert it into my SharePoint 2013 home page.</p>
  
  <p>The click even does nothing at all. Actually, when run in debug, I can see that the constructor, OnInit() and Page_Load() all execute but btnSubmitThis_Click() does not.</p>
  
  <p>The Web part does have an ascx.g.cs file attached. </p>
  
  <p>I can see that this file also includes the code below, showing that the event does handle the method properly:</p>
  
  <pre><code>        [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Never)]
      [GeneratedCodeAttribute("Microsoft.VisualStudio.SharePoint.ProjectExtensions.CodeGenerators.SharePointWebP" +
          "artCodeGenerator", "12.0.0.0")]
      private global::System.Web.UI.WebControls.Button @__BuildControlbtnSubmitThis() {
          global::System.Web.UI.WebControls.Button @__ctrl;
          @__ctrl = new global::System.Web.UI.WebControls.Button();
          this.btnSubmitThis = @__ctrl;
          @__ctrl.ApplyStyleSheetSkin(this.Page);
          @__ctrl.ID = "btnSubmitThis";
          @__ctrl.Text = "Submit";
          @__ctrl.Click -= new System.EventHandler(this.btnSubmitThis_Click);
          @__ctrl.Click += new System.EventHandler(this.btnSubmitThis_Click);
          return @__ctrl;
      }
  </code></pre>
  
  <p>There are no errors generated that I can see, the click event simply does not call the method.</p>
  
  <p>What could I be missing here?</p>
  
  <p>I am ready to answer any question, as I really would love to figure this one out and I have spent a few days trying on my own, already.</p>
  
  <p>Thanks a lot in advance for your help.</p>
  
  <p>Code added by request:</p>
  
  <p>ascx:</p>
  
  <pre><code>&lt;%@ Assembly Name="$SharePoint.Project.AssemblyFullName$" %&gt;
  &lt;%@ Assembly Name="Microsoft.Web.CommandUI, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %&gt; 
  &lt;%@ Register Tagprefix="SharePoint" Namespace="Microsoft.SharePoint.WebControls" Assembly="Microsoft.SharePoint, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %&gt; 
  &lt;%@ Register Tagprefix="Utilities" Namespace="Microsoft.SharePoint.Utilities" Assembly="Microsoft.SharePoint, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %&gt;
  &lt;%@ Register Tagprefix="asp" Namespace="System.Web.UI" Assembly="System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" %&gt;
  &lt;%@ Import Namespace="Microsoft.SharePoint" %&gt; 
  &lt;%@ Register Tagprefix="WebPartPages" Namespace="Microsoft.SharePoint.WebPartPages" Assembly="Microsoft.SharePoint, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %&gt;
  &lt;%@ Control Language="C#" AutoEventWireup="true" CodeBehind="HelloWorldWebPart.ascx.cs" Inherits="HelloWorld.HelloWorldWebPart.HelloWorldWebPart" %&gt;
  &lt;p&gt;
      Name:
      &lt;asp:TextBox ID="txtTextBox" runat="server"&gt;&lt;/asp:TextBox&gt;
  &amp;nbsp;&lt;asp:Button ID="btnSubmitThis" runat="server" OnClick="btnSubmitThis_Click" Text="Submit" /&gt;
  &lt;/p&gt;
  &lt;asp:Label ID="lblOutput" runat="server"&gt;&lt;/asp:Label&gt;
  </code></pre>
  
  <p>ascx.cs: </p>
  
  <pre><code>using System;
  using System.ComponentModel;
  using System.Web.UI.WebControls.WebParts;
  
  namespace HelloWorld.HelloWorldWebPart
  {
  [ToolboxItemAttribute(false)]
  public partial class HelloWorldWebPart : WebPart
  {
      // Uncomment the following SecurityPermission attribute only when doing Performance Profiling on a farm solution
      // using the Instrumentation method, and then remove the SecurityPermission attribute when the code is ready
      // for production. Because the SecurityPermission attribute bypasses the security check for callers of
      // your constructor, it's not recommended for production purposes.
      // [System.Security.Permissions.SecurityPermission(System.Security.Permissions.SecurityAction.Assert, UnmanagedCode = true)]
      public HelloWorldWebPart()
      {
      }
  
      protected override void OnInit(EventArgs e)
      {
          base.OnInit(e);
          InitializeControl();
      }
  
      protected void Page_Load(object sender, EventArgs e)
      {
          int Test = 0;
      }
  
      protected void btnSubmitThis_Click(object sender, EventArgs e)
      {
          lblOutput.Text = "Hello, " + txtTextBox.Text;
      }
  }
  }
  </code></pre>