title: RegisterStartupScript in User Control does not reload/ rewrite Javascript
body: <p><strong>UPDATE</strong> </p>
  
  <p>Summary of the problem:</p>
  
  <ol>
  <li><p>There are 6 Dynamic UCs which are generated and each has its own custom JS which is injected using RegisterStartUpScript on Page Init of UC</p></li>
  <li><p>Only the 1st time the Parent Page which generates the 1st UC will have the script correctly placed at the bottom of the page.</p></li>
  <li><p>On subsequent Partial Updates ( AJAX call ) to generate the new UC, the associated script is not injected...</p></li>
  </ol>
  
  <p>I'll continue searching and try different things, but if anyone can guide me, it 'll be greatly appreciated
  Thanks!</p>
  
  <p><strong>Below is the full explanation</strong></p>
  
  <p>I have a Parent page using a Master in which the RadScriptManager is defined ( telerik's Script manager). The Parent Page has a placeholder where a dynamic User Control is generated . The UC has a javascript which I inject on Page_Init of UC.</p>
  
  <p>When I call it the first time, 1st page load, the script works correctly.. I can see it on the source code in Chrome debugger. When I change a ddl on the Parent, it 's call and generate another UC within the placeholder. The latter has its own Javascript Inject similar to the first one generated... both UC are basically Views for each province so it has the same structure but the form content are slightly different...</p>
  
  <p>The problem is, when I view the Chrome Debugger i see the partial update of the content of the User COntrol, but i do not see the new script from the 2nd control which was supposed to be added to add_load on Page_Init of the UC. So Everytime , I change control, it calls the previous script... although my code goes through the section below... which is basically registering the appropriate script for the given control being loaded.</p>
  
  <p>In the example below, I always see an alert "SK cmbSearch = .."  as opposed to "ON cmbSearch = ..." which is the current province i was trying to load.</p>
  
  <p>Can anyone give me some pointers?</p>
  
  <pre><code>public void RegisterSearchVisibilityPPSA()
  {
  string jsFunction =
  @"function DefineView(sender, eventArgs) {
      var comboSearch = $find('%%cmbSearchType%%');
      //cmbSearch Section
      alert('ON cmbSearch = %%cmbSearchType%% with value = ' + comboSearch.get_selectedItem().get_value() );
      switch (comboSearch.get_selectedItem().get_value()) {
          //PER 
          case 'IN':
          case 'IS' :
              $('#tblPersonSearchForm').show();
              $('#tblPersonDOBSearchForm').show();
              $('#tblBusinessSearchForm').hide();
              $('#tblSerialNumberedSearchForm').hide();
              break;
          //BUS 
          case 'BD':
              $('#tblPersonSearchForm').hide();
              $('#tblPersonDOBSearchForm').hide();
              $('#tblBusinessSearchForm').show();
              $('#tblSerialNumberedSearchForm').hide();
              break;
          //SER 
          case 'MVE':
          case 'MVS':
              $('#tblPersonSearchForm').hide();
              $('#tblPersonDOBSearchForm').hide();
              $('#tblBusinessSearchForm').hide();
              $('#tblSerialNumberedSearchForm').show();
              break;
          //REG 
          case 'REG':
          default:
              $('#tblPersonSearchForm').hide();
              $('#tblPersonDOBSearchForm').hide();
              $('#tblBusinessSearchForm').hide();
              $('#tblSerialNumberedSearchForm').hide();
              $('#tblRegistrationNumberedSearchForm').show();
              break;
      }
  
  
  }
  
  function onPageLoad(){
      // jquery Area
      $(document).ready(function () {
          DefineView();
      });
  }
  ";
  
  
  RadScriptManager.RegisterStartupScript(this, this.GetType(), "ON_SearchVisibilityPPSA",jsFunction.Replace("%%cmbSearchType%%", cmbSearchType.ClientID), cmbRegistrationType.ClientID), true);
  string onLoadScript = @" Sys.Application.add_load(function(){ onPageLoad();}) ";
  RadScriptManager.RegisterStartupScript(this, this.GetType(), "ON_onLoadScript", onLoadScript, true);
  }
  </code></pre>