title: ScriptManager.RegisterStartupScript Keeps adding script blocks multiple times
body: <p>I have an update panel with a timer control set up to automatically check for some data updates every minute or so.</p>
  
  <p>If it sees that the data updates, it is set to call a local script with the serialized JSON data.</p>
  
  <pre><code>ScriptManager.RegisterStartupScript(UpdateField, GetType(HiddenField), ACTION_CheckHistoryVersion, "updateData(" &amp; data &amp; ");", True)
  </code></pre>
  
  <p>where "data" might look something like </p>
  
  <pre><code>{
     "someProperty":"foo",
     "someOtherProperty":"bar",
     "someList":[
       {"prop1":"value"},
       {"prop2":"value"}, ...
     ],
     "someOtherList":[{},...,{}]
  }
  </code></pre>
  
  <p>"data" can get quite large, and sometimes only a few items change. </p>
  
  <p>The problem I am having is this. Every time I send this back to the client, it gets added as a brand new script block and the existing blocks do not get removed or replaced. </p>
  
  <p>output looks something like this:</p>
  
  <pre><code>&lt;script type="text/javascript"&gt;
    updateData({
         "someProperty":"foo",
         "someOtherProperty":"bar",
         "someList":[
           {"prop1":"value"},
           {"prop2":"value"}, ...
         ],
         "someOtherList":[{},...,{}]
      });
  &lt;/script&gt;
  &lt;script type="text/javascript"&gt;
    updateData({
         "someProperty":"foo",
         "someOtherProperty":"bar",
         "someList":[
           {"prop1":"changed"},
           {"prop2":"val"}, ...
         ],
         "someOtherList":[{},...,{}]
      });
  &lt;/script&gt;
  &lt;script type="text/javascript"&gt;
    updateData({
         "someProperty":"foos",
         "someOtherProperty":"ball",
         "someList":[
           {"prop1":"changed"},
           {"prop2":"val"}, ...
         ]
      });
  &lt;/script&gt;
  </code></pre>
  
  <p>with a new script block being created every time there is a change in the data.</p>
  
  <p>Over time the amount of data accumulating on the browser could get potentially huge if we just keep adding this and I can't imagine how most people's browser would take it, but I don't think it could be good. </p>
  
  <p>Does anyone know if there is a way to just replace the code that has been sent back to the browser rather than continuously adding it like this?</p>