title: Pass a file path to a Javascript function from C# code behind
body: <p>I have this javascript function in a .aspx file.</p>
  
  <pre><code>&lt;script&gt;
  function somefun(value) 
  {
         document.getElementById("myFlash").SetVariable("player:jsUrl", value);
         document.getElementById("myFlash").SetVariable("player:jsPlay", "");
  
  }
  &lt;/script&gt;
  </code></pre>
  
  <p>I'm calling and passing a value to that function inside a <strong>onclick event</strong> in the <strong>code-behind</strong> class.</p>
  
  <pre><code>protected void DownloadFile(object sender, EventArgs e)
      {
          string filePath1 = "Audio/songname.mp3";
  
          ScriptManager.RegisterClientScriptBlock(this, typeof(string), "Registering", String.Format("somefun('{0}');", filePath1), true);
  
  
      }
  </code></pre>
  
  <p>But when I click the button, I'm getting this error.
  <strong>'Unable to get property 'SetVariable' of undefined or null reference'</strong></p>
  
  <p>The javascript function is correct and I checked it. I think something is wrong with the way I passing the parameter.</p>