title: Response.write and ASP.NET controls
body: <p>Please see the code below:</p>
  
  <pre><code>Protected Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs) Handles Me.Load
          Response.Write("&lt;table&gt;&lt;tr&gt;&lt;td&gt;some text&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;")
          Response.Flush()
          Threading.Thread.Sleep(3000)
          Response.Write("&lt;table&gt;&lt;tr&gt;&lt;td&gt;some text&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;")
          Response.Flush()
          Threading.Thread.Sleep(3000)
          Response.Write("&lt;table&gt;&lt;tr&gt;&lt;td&gt;some text&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;")
          Response.Flush()
          Threading.Thread.Sleep(3000)
          Response.Write("&lt;table&gt;&lt;tr&gt;&lt;td&gt;some text&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;")
          Response.Flush()
          Threading.Thread.Sleep(3000)
      End Sub
  </code></pre>
  
  <p>The code works as I would expect i.e. a HTML table is generated and written to the screen, then after three seconds another table is generated and added to the screen etc.</p>
  
  <p>I have a webpage that dynamically adds x number of tables (<a href="http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.table%28v=vs.110%29.aspx" rel="nofollow">http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.table%28v=vs.110%29.aspx</a>) to a webpage.  However, Response.Flush does not seem to work.  I have created the simple code below to explain the problem:</p>
  
  <pre><code>Protected Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs) Handles Me.Load
          Dim Table1 As New Table
          Dim r As New TableRow()
          Dim c As New TableCell()
          c.Text = "Test 1"
          r.Cells.Add(c)
          Table1.Rows.Add(r)
          Response.Flush()
          Threading.Thread.Sleep(3000)
  
          Dim Table2 As New Table
          Dim r2 As New TableRow()
          Dim c2 As New TableCell()
          c.Text = "Test 2"
          r.Cells.Add(c)
          Table1.Rows.Add(r)
      End Sub
  </code></pre>
  
  <p>Is it possible to flush table1 to the client, then wait a few seconds then flush table2 or do you have to write a string to response.write?</p>