How do I start writing a table to the browser berfore all rows are rendered?

  • Thread starter Thread starter mortb
  • Start date Start date
M

mortb

Hi!

I have a really large and complex table.
The table may consist of several thousand rows.
When I render the table with asp.net web controls the control won't stream
out to the browser before the appending of rows is completed.
The table is created in a custom web control. I know I can use
Response.Write to directly output to the client, but I'd like to know if
there is another way.

cheers,
mortb
 
This is how IE behaves (not sure about other browsers). The table is being
streamed to the browser, but IE will only render it when it has the complete
table. It is only when it gets all rows that it can know how the table is
to look.
 
Generally you need to close the table tag before the browser is able to
render the whole table. In this case you could also try the table-layout
attribute :
http://msdn.microsoft.com/library/d...or/dhtml/reference/properties/tablelayout.asp
that should allows to render one row at a time (you'll need also to disable
buffering).

My personal preference would be likely to page data if possible (and/or
rendering filtered data). Are those rows browsed by a user ? Doesn't he have
a search or filtering mechanism to find what he is interested among those
several thousands of rows ?

Please let us know if table-layout worked...
 
mortb said:
Hi!

I have a really large and complex table.
The table may consist of several thousand rows.
When I render the table with asp.net web controls the control won't stream
out to the browser before the appending of rows is completed.
The table is created in a custom web control. I know I can use
Response.Write to directly output to the client, but I'd like to know if
there is another way.

No, there is no other way. When you are using server controls, none of
the final html code exist before all server controls are added to the page.

You can use Response.Write and Response.Flush to create output and flush
it to the browser. Don't make a flush after each row, though. Then you
would be sending each row in a separate TCP/IP package, which would
produce a huge amount of overhead.

Also consider what Patrice said about paging and filtering. The user
might not even want what you are trying to do now.
 
There is paging, the customer wants to be able to show the whole result at a
time, though. DOH! ;-)

If I'd draw the table usining response write I guess that means that that
the whole page would have to be output using response write wouldn't it lead
to better performance if I'd put the page in a httphandler instead of an
aspx page?

thanks for the replies!
/mortb
 
Back
Top