title: Unable to get value of input using ASP.NET
body: <p>I'm trying to return some text which was inputted into a textbox element on my website. After entering some text into it I noticed that this didn't return data:</p>
  
  <pre><code>document.getElementById('myTextBox').text;
  </code></pre>
  
  <p>But this did:</p>
  
  <pre><code>document.getElementById('myTextBox').value;
  </code></pre>
  
  <p>EDIT: The javascript above was used client side to test what was being read, using .text returns an empty string which, when passed back to the server, did indeed show an empty string. .value contained my entered data but when I tried using .value server side the errors occurred. </p>
  
  <p>However in my .cs class when I tried to add the following:</p>
  
  <pre><code>string myInput = myTextBox.Value;
  </code></pre>
  
  <p>I get an error message saying </p>
  
  <blockquote>
    <p>"System.Web.UI.WebControls.TextBox doesn't contain a definition for
    'Value'...".</p>
  </blockquote>
  
  <p>The example I was referencing came from here: <a href="http://www.aspsnippets.com/Articles/Get-value-of-HTML-Input-TextBox-in-ASPNet-code-behind-using-C-and-VBNet.aspx" rel="nofollow">http://www.aspsnippets.com/Articles/Get-value-of-HTML-Input-TextBox-in-ASPNet-code-behind-using-C-and-VBNet.aspx</a> </p>
  
  <p>My textbox is declared like: </p>
  
  <pre><code>&lt;asp:TextBox ID="myTextBox" runat="server"&gt;&lt;/asp:TextBox&gt;
  </code></pre>
  
  <p>However when I try to change the TextBox element to an Input element I get an error saying "The type or namespace name 'Input' does not exist..."</p>
  
  <p>How can I pass the data which was entered into my TextBox back to the server? </p>