title: get HiddenField Value from javascript to use in code-behind WITHOUT A BUTTON NOR POSTBACK
body: <p>I have an html page that has a link to an external javascript file namely <code>external.js</code> as follows </p>
  
  <p><code>&lt;script type =" text/javascript" src="external.js"&gt;&lt;/script&gt;</code></p>
  
  <p>The page includes an <code>&lt;asp:HiddenField&gt;</code> defined as <code>Hidden1</code>. </p>
  
  <p>In my external .js file there is a function <code>passData()</code> which basically populates <code>Hidden1</code> with some values. The way I do it is as follows. </p>
  
  <p>On <strong>HTML</strong></p>
  
  <p><code>&lt;script&gt; passData("&lt;%=Hidden1.ClientID%&gt;") &lt;/script&gt;</code>  then in <code>external.js</code>:</p>
  
  <pre><code>function passData(hiddenFieldID)
  {
  document.getElementByID(hiddenFieldID).Value = "Value";
  }
  </code></pre>
  
  <p>What I have been trying for some while now is to get the value of <code>Hidden1</code> from my code behind in <code>vb.net</code> by using: </p>
  
  <p><code>Dim str = Hidden1.value</code></p>
  
  <p>However, with no luck. I have noticed that I should perform some sort of postback so that the value can be taken. However, what I am thinking of is that how on my html page the value of <code>Hidden1</code> is showing when I use <code>alert</code> and at the same time I am not able to retrieve it on <code>page_load</code> in my <code>.aspx</code> unless I perform a postback. In my application I am really eager to get it working without having the need to add a button to initialize postbacks. I need to get <code>Hidden1</code> value in my <code>.aspx</code> code-behind page in order to store it in a database. Any suggestions or ideas ? </p>