Response.flush not working ASP.NET

I have an aspx page where I process a large number of records from a table and do some manipulations. After each manipulation (each record) I have Response.Write ("Record:" + rec); Response.Flush, ()

I set the Response.Buffer property to false. It works fine. But if I want to display the output as a table row, it does not work with Response.Write. After all the records are completed, only in a loop the table is printed

How to solve this?

+2
source share
5 answers

Most browsers will not display tables until the table is complete. You can try to create a fixed table format, css table-layout: fixed, and also specify the column sizes.

+7
source

For everyone who has this problem ...

Keep in mind that if your IIS server compresses output using GZIP, it seems to ignore all Response.Flush calls. This is enabled by default in IIS7 and Windows 7.

And if you are testing Fiddler, be sure to enable the "Streaming" mode, or Fiddler will collect the reddened HTML and hold it until the connection is completed.

+15
source

I will add to Darryl the answer that you can close the table as soon as possible and then populate the rest of the table with jQuery or similar.

+1
source

I would suggest that the table does not exist from the point of view of the browser until you write out the tag of the final table.

You can write a bunch of divs with a style sheet that controls their width.

 .column1 { width: 40px; } .column2 { width: 40px; } Response.Write("<div id=\"column1\">some text</div><div id=\"column2\">some text</div>"); Response.Flush(); 

Or can you write a whole table for each row ...?

 Response.Write("<table><tr><td>some text</td></tr></table>"); Response.Flush(); 
0
source

Definitely a table. To prove this to yourself, change the table-oriented markup of response.Write () s to plain text only. you will see how it accumulates. If the table should be so large and you want to display it from the server, you must correct the size of the columns and split the table into one row or some other subset so that the content is displayed gradually as you need.

0
source

All Articles