title: Get current TextBox Text value in a button onClick event - asp.net
body: <p>I have such a page  </p>
  
  <pre><code>&lt;form runat="server" id="NewForm"&gt;
      Name: &lt;asp:TextBox ID="Name" runat="server"&gt;&lt;/asp:TextBox&gt;
      &lt;asp:Button ID="AddNewName" runat="server" Text="Add" OnClick="AddNewName_Click" /&gt;
      &lt;asp:Label ID="NewName" runat="server"&gt;&lt;/asp:Label&gt;
  &lt;/form&gt;
  </code></pre>
  
  <p>In the code behind, I have a Page_Load which assign a value to the TextBox Name.</p>
  
  <pre><code>protected void Page_Load(object sender, EventArgs e)
  {
      Name.Text = "Enter Your Name Here";
  }
  </code></pre>
  
  <p>Then upon the Click on the button AddNewName, I will write it in the Label NewName</p>
  
  <pre><code>protected void AddNewDivision_Click(object sender, EventArgs e)
  {
      NewName.Text = Name.Text;
  }
  </code></pre>
  
  <p>But, no matter what I input in the Name TextBox, the Label only displays "Enter Your Name Here". It never updates to the actual content in the Name TextBox. What am I doing wrong with this code?</p>