title: Unregistering a javascript block in C#/ASP.net
body: <p>stuck on a problem to do with registering and then unregistering a block of javascript code. How can I unregister GRIDqrarefreshexposurereport?</p>
  
  <ol>
  <li>The below code will show a radio button list when the datasource of my grid is null.</li>
  <li><p>Upon Selection, the page will refresh, the datasource and grid will be populated and the radio button list will be hidden due to GRIDqrarefreshexposurereport.</p></li>
  <li><p>Upon clicking a cancel button, the datasource is set to null, the page is reloaded, the grid is empty and the radio button lists never appear even though they should.</p></li>
  </ol>
  
  <p>Have debugged the code, and it runs through the correct blocks of code, however when I look at the source code of my ASP.net page both blocks of javascript are present, with the GRIDqrarefreshexposurereport block appearing last which is why i think the radio button list is not reappearing.</p>
  
  <p>If anything is unclear I'll do my best to clarify, any tips on how to make this clearer gladly taken.</p>
  
  <pre><code>if (gridExposureList.DataSource == null)
  {
      ClientScript.RegisterStartupScript(this.GetType(), "qrarefreshexposurereport",                                  // Framework 2.0 conversion
              @"&lt;script language=""javascript"" type=""text/javascript""&gt;
                          document.getElementById(""NoFilter"").style.display = ""None"";
                          document.getElementById(""RefreshEventsSummaryTiming"").style.display = ""none"";
                          document.getElementById(""RefreshEventsSummaryXPOS"").style.display = ""none"";
                          document.getElementById(""RefreshEventsSummaryFilter"").style.display = """";
                          document.getElementById(""QRAList"").style.display = ""none"";
          document.getElementById(""RefreshExpRepFilter"").style.display = """";
          document.getElementById(""GridButtons"").style.display = ""none"";
                          &lt;/script&gt;
                          ");
  }
  else
  {
      ClientScript.RegisterStartupScript(this.GetType(), "GRIDqrarefreshexposurereport",                                  // Framework 2.0 conversion
          @"&lt;script language=""javascript"" type=""text/javascript""&gt;
                      document.getElementById(""NoFilter"").style.display = ""None"";
                      document.getElementById(""RefreshEventsSummaryTiming"").style.display = ""none"";
                      document.getElementById(""RefreshEventsSummaryXPOS"").style.display = ""none"";
                      document.getElementById(""RefreshEventsSummaryFilter"").style.display = """";
                      document.getElementById(""QRAList"").style.display = ""none"";
      document.getElementById(""RefreshExpRepFilter"").style.display = ""none"";
      document.getElementById(""GridButtons"").style.display = """";
                      &lt;/script&gt;
                      ");
  }
  </code></pre>