title: ASP.NET AJAX partial postback, dynamic JavaScript values
body: <p>I am working with a user control which is inside an UpdatePanel. The user control uses swfobject to add a flash object to a div in the user control. Part of the functionality of the user control is it allows the user to change 'channel'. The channel is set and handled in the code behind hence the call in the JavaScript below to &lt;%=channel%>.</p>
  
  <p>The problem I have is that when the new channel is saved, the JavaScript code below is still pointing to the old channel. The only way I can fix this is to refresh the page via the code behind, but I'm thinking there must be a better way to do this...</p>
  
  <p>Can anyone help?</p>
  
  <pre><code>&lt;script type="text/javascript"&gt;
  //Required to readd the widget to the div after partial postback
  var prm = Sys.WebForms.PageRequestManager.getInstance(); 
  prm.add_pageLoaded(flashVideo_&lt;%=widgetId%&gt;); 
  
  // SWFObject embed
  function flashVideo_&lt;%=widgetId%&gt;() {
      var flashvars = {
      initialURL: escape(document.location),
      paramXMLPath: "/videoprotoype/single-video.aspx?channel=&lt;%=channel%&gt;"          
      }
      var params = {
          bgcolor: "#121212",
          allowfullscreen: "true"
      }
      var attributes = {}
      swfobject.embedSWF("/videoprotoype/assets/slideshowpro.swf", "video_&lt;%=widgetId%&gt;", "285", "215", "10.0.0", false, flashvars, params, attributes);
  } 
   &lt;/script&gt;   
   &lt;div id="video_&lt;%=widgetId%&gt;"&gt;
   &lt;/div&gt;
  </code></pre>