473,395 Members | 1,969 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,395 software developers and data experts.

How to slowly add content to a web page?

When a user clicks on a button on my aspx page it launches a bunch of
threads which go and do things which might take a few seconds each.
Rather than waiting for all threads to complete before rendering the
response, is there a way to show the current status of each thread?

Ideally the status would be shown in a literal control or a textbox. It
would say maybe "thread started" and on completion "thread completed",
and in no particular order.

This would be analagous to a very slow rendering of the page.

How can this be implemented?

Thanks for your help.
Nov 18 '05 #1
9 1154
I can't even imagine why would you need to open several
threads on a server while it processing the request? One
exception: sending email, but usually it takes no time
anyway.

The simple answer is no. But you can try to redirect user
on the same page with different text attribute of your
control using server timer. Never done this before because
there was no need :)

-----Original Message-----
When a user clicks on a button on my aspx page it launches a bunch ofthreads which go and do things which might take a few seconds each.Rather than waiting for all threads to complete before rendering theresponse, is there a way to show the current status of each thread?
Ideally the status would be shown in a literal control or a textbox. Itwould say maybe "thread started" and on completion "thread completed",and in no particular order.

This would be analagous to a very slow rendering of the page.
How can this be implemented?

Thanks for your help.
.

Nov 18 '05 #2
No. What the client is looking at is the RESULT of the processing that has
already taken place and completed on the server. You can think of it this
way, the web page that the client is looking at is the results from some
process that has already completed and moved on to other things.

Now, if you wanted to get into ActiveX controls or Java Applets, that would
be a different story because those are self-contained executable programs
that are launched from a web page but (once launched) can run independant of
it.
"Bruce W.1" <br***@noDirectEmail.com> wrote in message
news:3F***************@noDirectEmail.com...
When a user clicks on a button on my aspx page it launches a bunch of
threads which go and do things which might take a few seconds each.
Rather than waiting for all threads to complete before rendering the
response, is there a way to show the current status of each thread?

Ideally the status would be shown in a literal control or a textbox. It
would say maybe "thread started" and on completion "thread completed",
and in no particular order.

This would be analagous to a very slow rendering of the page.

How can this be implemented?

Thanks for your help.

Nov 18 '05 #3
One solution is to pass the response object as a parameter to each thread.
The thread can freely write to it whenever it starts and whenver it is done.
When you need the screen to update after thread processing you would call
the static flush method on the Response object. Off the top of my head, i'm
not sure if you will run into synchronization issues since it depends on
what part of the response object you manipulate - some methods are thread
safe others are not.

Alternatively, you can use the session object to transfer data from threads
to your main thread. Set up your main page to continuously refresh itself.
With each refresh, you check a session variable flag to determine if there
is data needed to be displayed on screen in the main page. If there is, you
retrieve data from a session variable and display it in the refresh
procedure and call flush on the response object. The session data variables
will be set by the individual threads. You will need to synchronize access.
The idea is roughly equivalent to a splash screen. That should be enough to
get you started.

--
Regards,
Alvin Bruney
Got DotNet? Get it here
http://home.networkip.net/dotnet/tidbits/default.htm
<an*******@discussions.microsoft.com> wrote in message
news:00****************************@phx.gbl...
I can't even imagine why would you need to open several
threads on a server while it processing the request? One
exception: sending email, but usually it takes no time
anyway.

The simple answer is no. But you can try to redirect user
on the same page with different text attribute of your
control using server timer. Never done this before because
there was no need :)

-----Original Message-----
When a user clicks on a button on my aspx page it

launches a bunch of
threads which go and do things which might take a few

seconds each.
Rather than waiting for all threads to complete before

rendering the
response, is there a way to show the current status of

each thread?

Ideally the status would be shown in a literal control or

a textbox. It
would say maybe "thread started" and on

completion "thread completed",
and in no particular order.

This would be analagous to a very slow rendering of the

page.

How can this be implemented?

Thanks for your help.
.

Nov 18 '05 #4
"Bruce W.1" <br***@noDirectEmail.com> wrote in
news:3F***************@noDirectEmail.com:
When a user clicks on a button on my aspx page it launches a
bunch of threads which go and do things which might take a few
seconds each. Rather than waiting for all threads to complete
before rendering the response, is there a way to show the
current status of each thread?

Ideally the status would be shown in a literal control or a
textbox. It would say maybe "thread started" and on completion
"thread completed", and in no particular order.

This would be analagous to a very slow rendering of the page.

How can this be implemented?


Bruce,

http://www.fawcette.com/vsm/2002_11/...tures/chester/

You should be able to adapt the article to meet your needs by having
a master ("status") thread that spawns and manages the child
("worker") threads.

Hope this helps.

Chris.
-------------
C.R. Timmons Consulting, Inc.
http://www.crtimmonsinc.com/
Nov 18 '05 #5
"Chris R. Timmons" wrote:

Bruce,

http://www.fawcette.com/vsm/2002_11/...tures/chester/

You should be able to adapt the article to meet your needs by having
a master ("status") thread that spawns and manages the child
("worker") threads.

Hope this helps.

Chris.
-------------
C.R. Timmons Consulting, Inc.
http://www.crtimmonsinc.com/

================================================== ===========

If I understand this right, the results aspx page is just slowly
displaying an XML document, transformed nicely into html.

Similar behavior comes from the display of a large text file, i.e. it
displays as it loads.

So then the million dollar question is, how can this behavior be put in
to an aspx web form? Or can this behavior be put in to an aspx web
form?
Nov 18 '05 #6
"Bruce W.1" <br***@noDirectEmail.com> wrote in
news:3F***************@noDirectEmail.com:
If I understand this right, the results aspx page is just slowly
displaying an XML document, transformed nicely into html.

Similar behavior comes from the display of a large text file,
i.e. it displays as it loads.

So then the million dollar question is, how can this behavior be
put in to an aspx web form? Or can this behavior be put in to
an aspx web form?


Bruce,

The output can be in any format you want. Instead of using an
XmlDocument, you could dynamically create ASP.NET web controls, or
insert text or HTML into a literal control.

I've ported the example code to C#, and modified it to use plain text
and a literal control instead of XML for output. If you'd like, I
can zip up the code and e-mail it to you (I'll need your e-mail
address of course). Or I could post it here if anyone else is
interested.

Chris.
-------------
C.R. Timmons Consulting, Inc.
http://www.crtimmonsinc.com/
Nov 18 '05 #7
Shouldn't have a problem implementing the suggestions left by others
here if you're also sure to:

- Set the page's BufferOutput property to True
- Called .Flush() after each line you want to output to the client as
the operation progresses.
- Made sure you don't have any open table tags between output. Some
browsers won't render partial tables, whether the output is flushed or not.

Also, remember that if you want to redirect or something after the
operation has completed, you'll need to do it in client script since the
HTTP headers have already been written out. Just a gotcha I've run into.

-----
Aaron Lewis
GuildPortal.com Development
www.guildportal.com

Nov 18 '05 #8
Aaron Lewis wrote:

Shouldn't have a problem implementing the suggestions left by others
here if you're also sure to:

- Set the page's BufferOutput property to True
- Called .Flush() after each line you want to output to the client as
the operation progresses.
- Made sure you don't have any open table tags between output. Some
browsers won't render partial tables, whether the output is flushed or not.

Also, remember that if you want to redirect or something after the
operation has completed, you'll need to do it in client script since the
HTTP headers have already been written out. Just a gotcha I've run into.

-----
Aaron Lewis
GuildPortal.com Development
www.guildportal.com


================================================== ==========

That sounds like really good advice and I must try it sometime. But I'm
sorry to say that I have shifted gears and turned it in to a No-Touch
Deployment (NTD) winforms program, and it works great. ASP.NET is not
so great for real-time information.

Of course it only runs on .NET. That's okay for now.

I wish Microsoft would let NTD programs run in an IE browser window.
Nov 18 '05 #9
Yeah I've done a WinForms version of my web-based application, and
working with Windows Forms is so much nicer than with web apps...
Partially because of the "neatness" factor of managing synchronization,
updating, and offline manipulation of data coming from a series of
remote web services, and using threads to do it. I'm a newbie to a lot
of parts of the .NET framework, so hitting new areas is great fun!

You know what would be REALLY cool, though? If the future version with
the Windows Forms or Avalon or whatever it's called, with the UI mark-up
called XAML (right?), could be portable between windows and web apps.
I mean, a treeview is a treeview right? If I have a Windows Forms app
with a TreeView and a ListView in it, and the output of the form is
XAML, why couldn't IIS or the framework itself see that and render
either a Windows Form or a Web Form, depending upon the context of the
client? THAT would be extremely cool. :)

By the way, about NTD in the browser, have you tried using the OBJECT
tag and referencing the DLL + class name for one of your Windows Forms
in HTML? I hear it works the way old-style OCX would..

-----
Aaron Lewis
GuildPortal.com Development
www.guildportal.com

Bruce W.1 wrote:
That sounds like really good advice and I must try it sometime. But I'm
sorry to say that I have shifted gears and turned it in to a No-Touch
Deployment (NTD) winforms program, and it works great. ASP.NET is not
so great for real-time information.

Of course it only runs on .NET. That's okay for now.

I wish Microsoft would let NTD programs run in an IE browser window.


--

Nov 18 '05 #10

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

Similar topics

2
by: Joshua Beall | last post by:
Hi All, I use register_shutdown_function to register a function that then gets run when the script finishes executing. It worked great before, but sometime last week on my development server...
7
by: lawrence | last post by:
This page renders slowly on both IE and Netscape - everything downloads before anything appears on screen. It is the behavior you'd expect if the whole thing was wrapped in a table, yet there is no...
0
by: Asad_Zaidi | last post by:
I have a website developed in ASP.NET and Content Management Server. This site's home page has a textbox which takes say an ID as input. The entered ID is then posted as a querystring to another...
5
by: Samy | last post by:
Hi There, I have a stored procedure which takes 7 sec to execute. I am using a adapter and filling the dataset. Then I bind the datagrid with the datatable from the dataset. When I test the page...
0
by: Timo | last post by:
My (intranet) aspx page finishes loading but the progress bar continues to advance very very very slowly, i.e. a new chunk on the bar is added 10 seconds or so, and then progress bar stops about...
9
by: K. Woodward | last post by:
I wouldn't consider myself a newbie, but this problem is making desire nothing more than a sledgehammer and enough money to buy a new computer (but don't kill the messenger, I suppose). I'm...
0
by: Managed Code | last post by:
Hello All, Here is my issue and thanks in advance for any assistance. I have a base page with a dropdownlist that fires an event with the selected index. The content page catches the event and...
1
by: 2291980 | last post by:
Hello I have create one page where on perticuler click i am calling 6 js function one after another. this all function are ajax function every thing is working fine . But issue is that it takes...
3
by: mthomsit | last post by:
Hi, I have a script which after a time shows the following error in IE: "A script on this page is causing Internet Explorer to run slowly. If it continues to run, your computer may become...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
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
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.