473,404 Members | 2,195 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.

progress bar status

CT
Dear All,
Is there any to show progress status of all activities like database retrieval, navigation from one page to another page? I am looking for some source code to integrated in my .net application.

Any help is very much appreciated.

Thank you
CT
Sep 27 '06 #1
3 1936
Hi,

CT wrote:
Dear All,
Is there any to show progress status of all activities like database retrieval, navigation from one page to another page? I am looking for some source code to integrated in my .net application.

Any help is very much appreciated.

Thank you
CT
To display server-side activity progress on the web client witout
periodically refreshing the page, you need to use AJAX.

Here is a previous post I made in that newsgroup:

The simplest implementation of AJAX in .NET is using ASHX Custom
HttpHandlers. It's very simple: In your web site or web application
project, Add New Item / Generic handler.

Then, in the code behind, implement the methods (Studio 2005 gives you a
template).

From the client, use JavaScript and XmlHttpRequest to send the request
and read the response. There are many tutorial online.

Example for a simple asynchronous request:

var oHttp = null;
if ( window.XMLHttpRequest )
{
oHttp = new window.XMLHttpRequest();
}
else
{
if ( window.ActiveXObject )
{
oHttp = new window.ActiveXObject( "Microsoft.XMLHTTP" );
}
else
{
throw "UNSUPPORTED PLATFORM";
}
}
if ( !oHttp )
{
throw "Cannot create XmlHttpRequest";
}

var strQuery = "?param1=value1&param2=value2";
oHttp.open( "GET",
"myHandler.ashx" + strQuery,
true ); // true = async, false = sync

oHttp.onreadystatechange = function()
{
if ( oHttp.readyState == 4 )
{
oHttp = null;
fnCallback( oHttp );
}
}

oHttp.send( null );

Code behind:

In ProcessRequest, use the "context" parameter to extract the
QueryString, and then you can process according to the parameters.

For the Response, if you want to send XML code back, make sure to set
context.Response.ContentType = "text/xml; charset=utf-8";

To save an XML document to the response, use
docResponse.Save(
new XmlTextWriter( context.Response.OutputStream,
context.Request.ContentEncoding ) );

In the JavaScript, the XML code will be available in oHttp.responseXML.
The response is also available in plain text in oHttp.responseText. Also
check the oHttp.status, which contains status like 200 (OK), 500 (Server
error), etc...

HTH,
Laurent
--
Laurent Bugnion, GalaSoft
Software engineering: http://www.galasoft-LB.ch
PhotoAlbum: http://www.galasoft-LB.ch/pictures
Support children in Calcutta: http://www.calcutta-espoir.ch
Sep 27 '06 #2

"Laurent Bugnion" <ga*********@bluewin.chwrote in message
news:ui**************@TK2MSFTNGP03.phx.gbl...
Hi,

CT wrote:
Dear All,
Is there any to show progress status of all activities like
database retrieval, navigation from one page to another page? I am looking
for some source code to integrated in my .net application.

Any help is very much appreciated.

Thank you
CT

To display server-side activity progress on the web client witout
periodically refreshing the page, you need to use AJAX.
Why? More specifically why is a asynchronous request needed?

A window.timeout to periodically kick off a request for progess info should
be sufficient there's no real need to make the request itself asynchronous
that I can see.
Here is a previous post I made in that newsgroup:

The simplest implementation of AJAX in .NET is using ASHX Custom
HttpHandlers. It's very simple: In your web site or web application
project, Add New Item / Generic handler.

Then, in the code behind, implement the methods (Studio 2005 gives you a
template).

From the client, use JavaScript and XmlHttpRequest to send the request
and read the response. There are many tutorial online.

Example for a simple asynchronous request:

var oHttp = null;
if ( window.XMLHttpRequest )
{
oHttp = new window.XMLHttpRequest();
}
else
{
if ( window.ActiveXObject )
{
oHttp = new window.ActiveXObject( "Microsoft.XMLHTTP" );
}
else
{
throw "UNSUPPORTED PLATFORM";
}
}
if ( !oHttp )
{
throw "Cannot create XmlHttpRequest";
}

var strQuery = "?param1=value1&param2=value2";
oHttp.open( "GET",
"myHandler.ashx" + strQuery,
true ); // true = async, false = sync

oHttp.onreadystatechange = function()
{
if ( oHttp.readyState == 4 )
{
oHttp = null;
fnCallback( oHttp );
}
}

oHttp.send( null );

Code behind:

In ProcessRequest, use the "context" parameter to extract the
QueryString, and then you can process according to the parameters.

For the Response, if you want to send XML code back, make sure to set
context.Response.ContentType = "text/xml; charset=utf-8";

To save an XML document to the response, use
docResponse.Save(
new XmlTextWriter( context.Response.OutputStream,
context.Request.ContentEncoding ) );

In the JavaScript, the XML code will be available in oHttp.responseXML.
The response is also available in plain text in oHttp.responseText. Also
check the oHttp.status, which contains status like 200 (OK), 500 (Server
error), etc...

HTH,
Laurent
--
Laurent Bugnion, GalaSoft
Software engineering: http://www.galasoft-LB.ch
PhotoAlbum: http://www.galasoft-LB.ch/pictures
Support children in Calcutta: http://www.calcutta-espoir.ch

Sep 27 '06 #3
Hi,

Anthony Jones wrote:
Why? More specifically why is a asynchronous request needed?

A window.timeout to periodically kick off a request for progess info should
be sufficient there's no real need to make the request itself asynchronous
that I can see.
In theory you're right. In praxis, however, I recommend against
synchronous XmlHttpRequest calls. If you send a synchronous request, the
whole JavaScript engine is blocked until the response arrives on the
client. It means that no animation, no other requests, no other
background activity will run as long as the response doesn't arrive.
Since we're on the web, it may take some time.

HTH,
Laurent
--
Laurent Bugnion, GalaSoft
Software engineering: http://www.galasoft-LB.ch
PhotoAlbum: http://www.galasoft-LB.ch/pictures
Support children in Calcutta: http://www.calcutta-espoir.ch
Sep 27 '06 #4

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

Similar topics

0
by: mirandacascade | last post by:
O/S - Windows XP Home with Service Pack 2 Vsn of Python: 2.4 (from ActiveState) This question is with regard to the progress bar controls that are in the file status.py. On my workstation,...
2
by: Champika Nirosh | last post by:
Hi All, Is there a way to add a Progress bar or any other control to a Status bar? Nirosh.
4
by: Kenneth Keeley | last post by:
Hi, I have a page that uploads files to my server and I wish to display a "Please wait while uploading" page to the user while the file is uploading. I have been able to redirect the user once the...
2
by: Robert Smith | last post by:
Hello, I have a problem with my progress bar, as shown in the attached code, the values on the bar are incremented within a threaded timer event. The timer works fine and ticks all the way...
6
by: Marko Vuksanovic | last post by:
I am trying to implement a file upload progress indicator (doesn't have to be a progress bar) using atlas... I do realize that the indicator cannot be implemented using Update panel control, but is...
5
by: Miro | last post by:
I will try my best to ask this question correctly. I think in the end the code will make more sence of what I am trying to accomplish. I am just not sure of what to search for on the net. I...
2
by: giddy | last post by:
hi , I'm in a slight dilemma. I have an updater program that checks for pending updates and downloads them if the users chooses to. Since i dont need a windows form to check if there is an...
2
by: =?Utf-8?B?RGF2ZQ==?= | last post by:
I'm using an async page to kick off a couple of asynchronous web services using the PageAsyncTask class. I'm also testing a progress bar that uses an Ajax UpdatePanel and Timer control to...
10
by: =?Utf-8?B?YXVsZGg=?= | last post by:
am having a hard time wrapping my head around "backgroundworker" class and updates to the window form that calls it. i have some questions about how to update windows form controls. i have...
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: 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...
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
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
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
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.