views:

26

answers:

2

Dear guys

I have a foreach which imports data to our CMS. Now I want to display a message with the current row info after every run. I don't want that the information is comming after the whole procedure. The message have to come step by step.

foreach()
{
    // my import procedure

    Response.Write("row x updated");
}

How can I do that? Can I do that with Response.Flush? Or do I have to make it else?

Best regards Michael

A: 

Response.Flush() seems to be the way to go. Otherwise, the responses are buffered.

Timores
+1  A: 

Set this once before you loop:

Response.BufferOutput = false;

Then call Response.Flush() every time you want to update the client.

Nick Craver
+1 That's the way I've done it in the past.
Zhaph - Ben Duguid