title: Retrieving value of disabled ASP.NET textbox
body: <p>I have 3 ASP.NET textboxes and one HiddenField. 
  The value of the third textbox (this is disabled) depends on the values of the other two. </p>
  
  <p>The formula is  </p>
  
  <blockquote>
    <p>txtPricepad = txtPrice/txtCarton</p>
  </blockquote>
  
  <pre><code>&lt;asp:TextBox ID="txtPriceCase" runat="server" onblur="javascript:GetPricePerPad();&gt;&lt;/asp:TextBox&gt;
  &lt;asp:TextBox ID="txtCarton" runat="server"&gt;&lt;/asp:TextBox&gt;
  &lt;asp:TextBox ID="txtPricePad" Enabled="false" runat="server" &gt;&lt;/asp:TextBox&gt;
  &lt;asp:HiddenField ID="hdPricepad" runat="server"/&gt;
  
    function GetPricePerPad()
    {
      var priceCase   = document.getElementById('ctl00_content_txtPriceCase').value;
      var cartons     = document.getElementById('ctl00_content_txtCarton').value;
      var res         = Number(priceCase) / Number(cartons);
  
      document.getElementById('ctl00_content_txtPricePad').value = res;
      document.getElementById('ctl00_content_hdPricepad').value = res;
    }
  </code></pre>
  
  <p>Assuming that the initial value of txtPricePad is 0 and txtCarton is 12. 
    When the value of txtPrice is changed to 1200, GetPricePerPad() will be called, thus txtPricePad will be 100.</p>
  
  <p>Javascript successfully changed the txtPricePad's value to 100 but when I am calling txtPricePad from the codebehind, its value is still 0. 
    That's why I assigned also the result of the formula to a HiddenField. Are there other ways to do this? I do not want to use HiddenField again.</p>