title: Passing value to javascript from asp.net
body: <pre><code>&lt;script type="text/javascript"&gt;
  
  function abc()
  {
      var id = document.getElementById('123');
      var caption= &lt;%=MyProperty %&gt;;
  }
  &lt;/script&gt;
  </code></pre>
  
  <p>code behind:</p>
  
  <pre><code>protected void Page_Load(object sender, EventArgs e)
  {
      Page.RegisterStartupScript(Guid.NewGuid().ToString(),"&lt;script language = 'javascript'&gt;abc();&lt;/script&gt;");
  }
  
  protected int MyProperty
  {
      get
      {
          return 123;
      }
  }
  </code></pre>
  
  <p>i need to pass string value to javascript, with int this codes works fine.</p>
  
  <pre><code>protected string MyProperty
  {
      get
      {
          return "123";
      }
  }
  </code></pre>
  
  <p>when i tried to pass string this code does't works.</p>