title: Passing value from code-behind to Javascript
body: <p>I am using a jQueryUI ProgressBar to show users how much allowed file storage they have used. The percentage is calculated in code-behind and should be passed to Javascript.</p>
  
  <p><strong>Aspx Code</strong></p>
  
  <pre><code>    &lt;asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" runat="server"&gt;
          &lt;script type="text/javascript"&gt;
              $(function () {
                  var pct = document.getElementById("filesPercentage").value;
                  $("#progressbar").progressbar({
                      value: pct
                  });
              });
          &lt;/script&gt;
      &lt;/asp:Content&gt;
  
      &lt;asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server"&gt;
        ...
       &lt;input type="hidden" runat="server" id="filesPercentage" /&gt;                      
       &lt;div id="progressbar"&gt;&lt;/div&gt;         
        ...
      &lt;/asp:Content&gt;
  </code></pre>
  
  <p><strong>Code Behind</strong></p>
  
  <pre><code>protected void Page_Load(object sender, EventArgs e)
  {
     filesPercentage.Value = "85";
  }
  </code></pre>
  
  <p>It seems like it can't get the percentage number from the hidden field. Any help would be appreciated.</p>