title: Pass C# Values To Javascript
body: <p>On loading the page I want to pass a value to my javascript function from a server side variable.</p>
  
  <p>I cannot seem to get it to work this is what I have:</p>
  
  <p>Asp.Net</p>
  
  <pre><code>protected void Page_Load(object sender, EventArgs e)
  {
      string blah="ER432";
  }
  </code></pre>
  
  <p>Javascript</p>
  
  <pre><code>&lt;script type="text/javascript"&gt;
  
      var JavascriptBlah = '&lt;%=blah%&gt;';
  
      initObject.backg.product_line = JavascriptBlah;
  
  &lt;/script&gt;
  </code></pre>
  
  <p>Adding this to the page</p>
  
  <pre><code> public string blah { get; set; }
  
  
          protected void Page_Load(object sender, EventArgs e)
          {
             blah="ER432";
          }
  </code></pre>
  
  <p>I still am getting an error:
  CS0103: The name 'blah' does not exist in the current context</p>
  
  <p>Also I would like to try and accomplish this without using hdden fields</p>