title: passing a variable to javascript function from code behind
body: <p>I want to pass a string value to a javascript function from code behind. As it is a the moment I get an uncaught reference error explaining that the value is not defined.</p>
  
  <pre><code>var variable= txtVariable.Value;
  ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "Registering", "RegisterTheUser("+variable+");", true);
  </code></pre>
  
  <p>Advice perhaps on the correct syntax</p>
  
  <p>This is the function</p>
  
  <pre><code>function RegisterTheUser(val) {
      alert(val);
  }
  </code></pre>
  
  <p>regards</p>