title: ScriptManager.RegisterStartupScript inside while loop only executed after breaking out of the loop
body: <p>I have a while loop in my codebehind and I want to monitor the progress, so each time I go into the loop, I wish my page draws something (a point) and when the loop breaks I would see the entire progress (scatterplot) My code is like the following:</p>
  
  <pre><code>          while (iter &lt;= Common.maxIter)
            {
              ScriptManager.RegisterStartupScript(this, this.GetType(), "myFunc" + iter.ToString(), "Display()", true);
  
              //doing something else
             }
  </code></pre>
  
  <p>The function Display() draws one point each time. My problem is, only after I break out of the while loop, all of the bars get drawn at the same time, but none of them is drawn during the loop...:(  I am not sure where went wrong, if I use break point and I can see this code gets executed everytime, just not shown on my page. </p>
  
  <p>Any one knows what should be the correct way of doing this?  Many thanks!</p>