Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Progress bar in .net

Status
Not open for further replies.

Denster

Programmer
Apr 9, 2001
198
GB
This is a general question on how to create a dynamic progress bar. I've read numerous articles but cant decide on the technology I should be using ie - Ajax, Javascript etc. The problem I've got is a process that imports data from a text file in to a database. This can take a few minutes so idealy I would like to display a progress bar that refreshes at 5% intervals. The process is happening in a class object in the code behind but cant figure out how to call a refresh from here. Any help on this or maybe a different method would be much appreciated.
 
ajax: asynchronous javascript and xml (a buzzword)
ajax is a methodology of using javascript thats all.

to report progress on the client while processing a request on the server requires the use of ajax. the simplest method is to make the request via ajax and display an animated image until the process is complete.

displaying the actual progress becomes a bit more challenging. check out website for ajax tips. he most recently did a post on ajax uploads. which would relate to what you require.

Jason Meckley
Programmer
Specialty Bakers, Inc.
 
Thanks for the link, there might be a few interesting points in there. Just to recap, its not the upload that is the problem. Its reading the file after it has uploaded where the problem lies. My intention was to get the number of lines in the text file before starting, then read the file line by line to do the importing process in to the database. When the number of lines reaches 5% of the total number of lines, refresh the progress bar then 10% and so on till the loop is complete.
 
ok, i put together a simple demo of how to do this with webforms, server controls and ms ajax. the example is better shown in a solution instead of posting all the code here. the code is simple, but there are too many files to post here.

Jason Meckley
Programmer
Specialty Bakers, Inc.
 
That would be great!, I will be very grateful if you could put something together. Ive been scratching my head over this for ages.
 
denster, tek-tips doesn't provide a link to send private/personal emails. they also keep deleting my messages that would give you my email address, in any form.

so to get in contact with me, visit this link
my contact information is provided there.

Jason Meckley
Programmer
Specialty Bakers, Inc.
 
Thanks for the sample Jason, it looks like it should do what I want.
However I am struggling to get it working.

It took a while to make it compatible with my version of Visual Studio but eventualy got it to compile and run.
The problem is when I press the import button I get an
"Object not set to an instance of an object" error on this line (statistics = Global.ImportServiceInstance.GetStatisticsFor(fileName);) in the progress.aspx.cs file.
I'm not exactly ofay with C sharp so I'm a bit stuck, more used to VB.

I will have a read up on C sharp and see if I can get any further.
In the mean time if you can provide any extra assistance I will be grateful.

Cheers

Dennis
 
Global is the object which inherits HttpApplicaiton. It contains a singleton of ImportService. I think in VB the keyword is Shared not static.
the singleton is instantiated when the application 1st starts.

Jason Meckley
Programmer
Specialty Bakers, Inc.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top