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!

web page Progress Bar

Status
Not open for further replies.

Denster

Programmer
Apr 9, 2001
198
GB
I have tried numerous examples to display a progress bar on a web page but cant find a suitable solution. What I have is some database processing that is in a loop in a code behind file. This process can take some time to complete so idealy I want to display a progress bar as it loops though these records. The old way could be written in the asp code and have some javascript function to update the bar. Codebehind seems to have made this job very tricky - if not impossible, can it be done?
 
Try creating an animated gif and placing it in a hidden <asp:panel>

In your code behind just before starting the processing make this panelm visible then hide it again when processing has finished.

I'm sure there are more elegant ways than this but it's one solution for you.

HTH

Smeat
 
That won't work. All processing is done, and then the page renders. You will never see the image show up and then disappear.
 
Tried the animated gif approach, but it doesnt animate. I have heard that Ajax is the the preferred method but dont know enough about it at the moment.
 
it doesn't matter if it animats or not. It won't work. The page does all processing, then renders, so you will never see the gif.

Look into AJAX, there are many examples out there.
 
Yep, just double checked how we did it and it was done on the client, not the server:

Code:
	<script language="javascript">
		function ShowProgress() {
			document.getElementById("trProgress").style.display= "block";
			
			// Set timer for psotback
			setTimeout(Postback, 2000);
		}
		
		function Postback() {
			setTimeout('__doPostBack(\'ctl00$ContentPlaceHolder1$txtLastNameCompany\',\'\')', 0);
		}
		
	 		
   </script>


Would probably go with Ajax if I need to do this in future though.

Smeat
 
Can anybody point me in the right direction on the Ajax route. Just to reiterate I need some form of animated graphic or progress bar running while the code behind loops through the records in the database.
All the samples I have tried trigger the graphic with a timer or just updates the a graphic on each press of a button.
I have downloaded the ajax extensions to use with visual studio so it shouldnt be too difficult - Should it!.
 
there are many video tutorials at ajax.asp.net teaching developers how to use the ajax controls.

Jason Meckley
Programmer
Specialty Bakers, Inc.
 
Great link!. I've watched a few of these videos and learned loads.
I didnt realise there was so much you could do with Ajax..
Thanks for the info
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top