473,404 Members | 2,179 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,404 software developers and data experts.

Console-ish output in a browser, how?

In my web application, I would like to dynamically display the
progress of a process, something like:

Collecting user input ...
Saving user profile ...
Generating report in PDF ...
Dispatching report to user email ...

This is something like the installation progress display of DotNetNuke
or the Oracle's web-based enterprise manager.

Any idea about how this is implemented? I sorta think it is a iframe,
but just a wild guess.

Thanks.
Dec 20 '07 #1
11 4373
its done with server push. turn off page bufferring

DoSomeWork();
Response.Write("working 1...<br>");
Rsponse.Flush();
DoSomeWork();
Response.Write("working 2...<br>");
Rsponse.Flush();

the markup must be simple or the browser will not render it until all of it
is recieved.

-- bruce (sqlwork.com)
"gnewsgroup" wrote:
In my web application, I would like to dynamically display the
progress of a process, something like:

Collecting user input ...
Saving user profile ...
Generating report in PDF ...
Dispatching report to user email ...

This is something like the installation progress display of DotNetNuke
or the Oracle's web-based enterprise manager.

Any idea about how this is implemented? I sorta think it is a iframe,
but just a wild guess.

Thanks.
Dec 20 '07 #2
My recommendation would be to use a ListBox control and insert items into
it as you return out messages to the user.

Using .Insert() at the zero index ensures that the newest messages show up
at the top...

Here's an example:

On your ASPX page:

<div>
<asp:ListBox ID="ConsoleOutput" runat="server" />
</div>

In your code-behind, classes, etc:

// Put an "item" for each line in the "console" output.
ConsoleOutput.Items.Insert(0, "Collecting user input ...");
ConsoleOutput.Items.Insert(0, "Saving user profile ...");
ConsoleOutput.Items.Insert(0, "Generating report in PDF ...");
ConsoleOutput.Items.Insert(0, "Dispatching report to user email
....");

ConsoleOutput.Items.Insert(0, "Collecting user input again... ");
ConsoleOutput.Items.Insert(0, "Saving another user profile ...");
ConsoleOutput.Items.Insert(0, "Generating another report in PDF
....");
ConsoleOutput.Items.Insert(0, "Dispatching the final report to
user email ...");

Events could fire off the control updating and/or placing it in an UpdatePanel
so your users can see it "scroll"...

HTH!

-dl

--
David R. Longnecker
http://blog.tiredstudent.com
In my web application, I would like to dynamically display the
progress of a process, something like:

Collecting user input ...
Saving user profile ...
Generating report in PDF ...
Dispatching report to user email ...
This is something like the installation progress display of DotNetNuke
or the Oracle's web-based enterprise manager.

Any idea about how this is implemented? I sorta think it is a iframe,
but just a wild guess.

Thanks.


Dec 20 '07 #3
On Dec 20, 11:45 am, bruce barker
<brucebar...@discussions.microsoft.comwrote:
its done with server push. turn off page bufferring

DoSomeWork();
Response.Write("working 1...<br>");
Rsponse.Flush();
DoSomeWork();
Response.Write("working 2...<br>");
Rsponse.Flush();

I had thought that it must be something trickier than this. Will
Thread.Sleep(2000) work in a webpage? In other words, will the next
output appear after 2 seconds' elapse like so?

DoSomeWork();

Thread.Sleep(2000);

Response.Write("working 1...<br>");
Rsponse.Flush();
DoSomeWork();

Thread.Sleep(2000);

Response.Write("working 2...<br>");
Rsponse.Flush();

I tried Thread.Sleep before in a webpage, it does not seem to work.
Dec 20 '07 #4
On Dec 20, 11:51 am, David R. Longnecker
<dlongnec...@community.nospamwrote:
My recommendation would be to use a ListBox control and insert items into
it as you return out messages to the user.

Using .Insert() at the zero index ensures that the newest messages show up
at the top...

Here's an example:

On your ASPX page:

<div>
<asp:ListBox ID="ConsoleOutput" runat="server" />
</div>

In your code-behind, classes, etc:

// Put an "item" for each line in the "console" output.
ConsoleOutput.Items.Insert(0, "Collecting user input ...");
ConsoleOutput.Items.Insert(0, "Saving user profile ...");
ConsoleOutput.Items.Insert(0, "Generating report in PDF ...");
ConsoleOutput.Items.Insert(0, "Dispatching report to user email
...");

ConsoleOutput.Items.Insert(0, "Collecting user input again... ");
ConsoleOutput.Items.Insert(0, "Saving another user profile ...");
ConsoleOutput.Items.Insert(0, "Generating another report in PDF
...");
ConsoleOutput.Items.Insert(0, "Dispatching the final report to
user email ...");

Events could fire off the control updating and/or placing it in an UpdatePanel
so your users can see it "scroll"...

HTH!

-dl
Thanks, I think your idea is absolutely cool. But, I guess it is then
necessary to CSS-format your listbox and make the frame and scroll bar
invisible. What do you think?
Dec 20 '07 #5
That's a good question--I've never had a great deal of luck styling ListBox
controls. If I need really heavy duty theming, I tend to create composite
controls of my own.

If you wanted the box to expand dynamically (rather than scroll), that's
possible too.. You could refactoring out the .Insert command and do something
like:

protected void Page_Load(object sender, EventArgs e)
{
// Put an "item" for each line in the "console" output.
ConsoleWriter(ConsoleOutput, "Collecting user input ...");
ConsoleWriter(ConsoleOutput, "Saving user profile ...");
ConsoleWriter(ConsoleOutput, "Generating report in PDF ...");
ConsoleWriter(ConsoleOutput, "Dispatching report to user email
....");

ConsoleWriter(ConsoleOutput, "Collecting user input again... ");
ConsoleWriter(ConsoleOutput, "Saving another user profile ...");
ConsoleWriter(ConsoleOutput, "Generating another report in PDF
....");
ConsoleWriter(ConsoleOutput, "Dispatching the final report to
user email ...");
}

protected void ConsoleWriter(ListBox listBox, string textToWrite)
{
listBox.Items.Insert(0, textToWrite);
listBox.Rows = listBox.Items.Count + 1;

}

That'll keep the ListBox 1 line "bigger" (that may not even be necessary,
can try with and without the +1) than the data it's holding. I'm sure others
on here have some creative ideas as well--I've just never sat down and hacked
out the actual ListBox control. :)

Good luck!

-dl

--
David R. Longnecker
http://blog.tiredstudent.com
On Dec 20, 11:51 am, David R. Longnecker
<dlongnec...@community.nospamwrote:
>My recommendation would be to use a ListBox control and insert items
into it as you return out messages to the user.

Using .Insert() at the zero index ensures that the newest messages
show up at the top...

Here's an example:

On your ASPX page:

<div>
<asp:ListBox ID="ConsoleOutput" runat="server" />
</div>
In your code-behind, classes, etc:

// Put an "item" for each line in the "console" output.
ConsoleOutput.Items.Insert(0, "Collecting user input ...");
ConsoleOutput.Items.Insert(0, "Saving user profile ...");
ConsoleOutput.Items.Insert(0, "Generating report in PDF ...");
ConsoleOutput.Items.Insert(0, "Dispatching report to user email
...");

ConsoleOutput.Items.Insert(0, "Collecting user input again... ");
ConsoleOutput.Items.Insert(0, "Saving another user profile ...");
ConsoleOutput.Items.Insert(0, "Generating another report in PDF
...");
ConsoleOutput.Items.Insert(0, "Dispatching the final report to
user email ...");
Events could fire off the control updating and/or placing it in an
UpdatePanel so your users can see it "scroll"...

HTH!

-dl
Thanks, I think your idea is absolutely cool. But, I guess it is then
necessary to CSS-format your listbox and make the frame and scroll bar
invisible. What do you think?


Dec 20 '07 #6
You can also set Response.Buffer = False at the top of your page and you
won't have to do all the Response.Flush() commands. Essentially you're
turning off bufferring so all responses are immediately sent to the browser.

tip: This also helps when a part of the page is taking a long time to load
while the rest of the page is fast. Instead of holding everybody hostage
you'd turn off the buffer and the slow image etc would load on its own sweet
time.

--
Mohamad Elarabi
Lead Developer. MCTS, MCPD.
"gnewsgroup" wrote:
On Dec 20, 11:45 am, bruce barker
<brucebar...@discussions.microsoft.comwrote:
its done with server push. turn off page bufferring

DoSomeWork();
Response.Write("working 1...<br>");
Rsponse.Flush();
DoSomeWork();
Response.Write("working 2...<br>");
Rsponse.Flush();

I had thought that it must be something trickier than this. Will
Thread.Sleep(2000) work in a webpage? In other words, will the next
output appear after 2 seconds' elapse like so?

DoSomeWork();

Thread.Sleep(2000);

Response.Write("working 1...<br>");
Rsponse.Flush();
DoSomeWork();

Thread.Sleep(2000);

Response.Write("working 2...<br>");
Rsponse.Flush();

I tried Thread.Sleep before in a webpage, it does not seem to work.
Dec 20 '07 #7
On Dec 20, 2:14 pm, David R. Longnecker <dlongnec...@community.nospam>
wrote:
That's a good question--I've never had a great deal of luck styling ListBox
controls. If I need really heavy duty theming, I tend to create composite
controls of my own.

If you wanted the box to expand dynamically (rather than scroll), that's
possible too.. You could refactoring out the .Insert command and do something
like:

protected void Page_Load(object sender, EventArgs e)
{
// Put an "item" for each line in the "console" output.
ConsoleWriter(ConsoleOutput, "Collecting user input ...");
ConsoleWriter(ConsoleOutput, "Saving user profile ...");
ConsoleWriter(ConsoleOutput, "Generating report in PDF ...");
ConsoleWriter(ConsoleOutput, "Dispatching report to user email
...");

ConsoleWriter(ConsoleOutput, "Collecting user input again... ");
ConsoleWriter(ConsoleOutput, "Saving another user profile ...");
ConsoleWriter(ConsoleOutput, "Generating another report in PDF
...");
ConsoleWriter(ConsoleOutput, "Dispatching the final report to
user email ...");
}

protected void ConsoleWriter(ListBox listBox, string textToWrite)
{
listBox.Items.Insert(0, textToWrite);
listBox.Rows = listBox.Items.Count + 1;

}

That'll keep the ListBox 1 line "bigger" (that may not even be necessary,
can try with and without the +1) than the data it's holding. I'm sure others
on here have some creative ideas as well--I've just never sat down and hacked
out the actual ListBox control. :)

Good luck!

-dl
Thank you very much. It's nice, but I still would rather not to see
the frame of the listbox. I believe this can be done through css
formating. I've seen people do similar stuffs with TextBox.
Dec 21 '07 #8
with the minor issuse that it will not appear until all processing is done
(page renders).

while you could use an ajax update panel, you would need to make a
request/postback per step.

a common server push approach is to post to an iframe, then render script to
update the main frame (google does this).

-- bruce (sqlwork.com)
"David R. Longnecker" wrote:
My recommendation would be to use a ListBox control and insert items into
it as you return out messages to the user.

Using .Insert() at the zero index ensures that the newest messages show up
at the top...

Here's an example:

On your ASPX page:

<div>
<asp:ListBox ID="ConsoleOutput" runat="server" />
</div>

In your code-behind, classes, etc:

// Put an "item" for each line in the "console" output.
ConsoleOutput.Items.Insert(0, "Collecting user input ...");
ConsoleOutput.Items.Insert(0, "Saving user profile ...");
ConsoleOutput.Items.Insert(0, "Generating report in PDF ...");
ConsoleOutput.Items.Insert(0, "Dispatching report to user email
....");

ConsoleOutput.Items.Insert(0, "Collecting user input again... ");
ConsoleOutput.Items.Insert(0, "Saving another user profile ...");
ConsoleOutput.Items.Insert(0, "Generating another report in PDF
....");
ConsoleOutput.Items.Insert(0, "Dispatching the final report to
user email ...");

Events could fire off the control updating and/or placing it in an UpdatePanel
so your users can see it "scroll"...

HTH!

-dl

--
David R. Longnecker
http://blog.tiredstudent.com
In my web application, I would like to dynamically display the
progress of a process, something like:

Collecting user input ...
Saving user profile ...
Generating report in PDF ...
Dispatching report to user email ...
This is something like the installation progress display of DotNetNuke
or the Oracle's web-based enterprise manager.

Any idea about how this is implemented? I sorta think it is a iframe,
but just a wild guess.

Thanks.

Dec 21 '07 #9
On Dec 21, 12:03 pm, bruce barker
<brucebar...@discussions.microsoft.comwrote:
with the minor issuse that it will not appear until all processing is done
(page renders).

while you could use an ajax update panel, you would need to make a
request/postback per step.

a common server push approach is to post to an iframe, then render script to
update the main frame (google does this).

-- bruce (sqlwork.com)
I just tried your approach, like what you've said, it will not appear
until all processing is done. In other words, you don't see those
output one after another with some pause in between them, even if you
use Thread.Sleep(5000) after each output. It does not work. You see
them all at once when the page renders.

Not sure how DotNetNuke does it for their installation process.
Dec 21 '07 #10
You must set Response.Buffer = False for response to go to the client
immediately. Please read my previous post.

Thanks,
--
Mohamad Elarabi
MCP, MCTS, MCPD.
"gnewsgroup" wrote:
On Dec 21, 12:03 pm, bruce barker
<brucebar...@discussions.microsoft.comwrote:
with the minor issuse that it will not appear until all processing is done
(page renders).

while you could use an ajax update panel, you would need to make a
request/postback per step.

a common server push approach is to post to an iframe, then render script to
update the main frame (google does this).

-- bruce (sqlwork.com)

I just tried your approach, like what you've said, it will not appear
until all processing is done. In other words, you don't see those
output one after another with some pause in between them, even if you
use Thread.Sleep(5000) after each output. It does not work. You see
them all at once when the page renders.

Not sure how DotNetNuke does it for their installation process.
Dec 21 '07 #11
On Dec 21, 2:57 pm, Mohamad Elarabi [MCPD]
<MohamadElarabiM...@discussions.microsoft.comwrote :
You must set Response.Buffer = False for response to go to the client
immediately. Please read my previous post.

Thanks,
--
Mohamad Elarabi
MCP, MCTS, MCPD.
Yes, Mohamad, thank you. I did set Response.Buffer= false; But it
does not work as expected.
Dec 21 '07 #12

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

19
by: Dave | last post by:
Hi, I have done some research, trying to Clear The Screen in java code. The first option was the obv: system.out.print("\n\n\n\n\n\n\n\n\n\n\n\n"); then i heard about this method:...
7
by: shawnk | last post by:
Hello Everyone How do you format format numbers right-justified using Console.WriteLine(), i.e I need to line up numbers in vertical columns and the MSDN documentation is pretty poor Here is the...
5
by: Publicjoe | last post by:
I am working on a little app which uses colour in the console window. I have created a class to extend the console functionality but the ClearScreen method does not work correctly. I am enclosing a...
17
by: MumboJumbo | last post by:
Hi I have a really basic question hopefully some can help me with: Can you write a (i.e. one) C# project that works from the cmd line and gui? I seems if i write a GUI app it can't write to...
1
by: Kevin | last post by:
In a newsgroup thread from Jan 8, 2003 between Barry Holsinger and the VBDotNet Team, please review this excerpt: "You understood my problem completely. Your sample code provides a really...
3
by: julianmoors | last post by:
Hey, Currently I'm writing a VB.NET/1.1 app and I need to mask the input for the password field. Does anyone know how to do this in VB? I've seen a C# example, but wouldn't know how to convert...
1
by: John Wright | last post by:
I am running a console application that connects to an Access database (8 million rows) and converts it to a text file and then cleans and compacts the database. When it runs I get the following...
2
by: SriBhargav | last post by:
Hi, I've a question on setting timeout on console.readline() I would like the user to input something through Console.readline() in 5 secs. If there is no input in that time, I would like to...
12
by: Dilip | last post by:
Hi All I have a server based C# console application. This application must hide its console window when its launched out on the field. So I dutifully P/Invoke'd FindWindow/ShowWindow...
3
by: Sheikko | last post by:
Sincerly is a little bit complicated to explain to you what I have in my mind, but I will try: Above all the problem is the type of data that I want to passe between these two applications. The...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.