devxlogo

Sneaky ASP Tricks Part 1: Display Progress During ASP Page Processing

Sneaky ASP Tricks Part 1: Display Progress During ASP Page Processing

hat’s a Sneaky ASP Trick? It’s a simple, elegant non-traditional solution to an ASP development issue. This article explains how to display a progress indicator in your ASP page when it is processing. “Can’t be done,” you say? It can, with a Sneaky ASP trick.

Let’s say you have an ASP page that is doing some processing before outputting data. You might be accessing a database, running a query, and formatting your data?all of which takes time. When this is going on, your user could be viewing a blank page with the browser’s top right hand corner icon spinning (or whatever else it does). There will be an hourglass cursor on this page so the user knows something is happening. But frequently, if users do not get a visible response in a few seconds, they may go away from your page. So how do you display a progress bar on your page?

The answer is very simple and sneaky. It requires using some space on your resulting page to display a progress bar. In this space, display an animated GIF that mimics a progress bar. When your processing is all done, just make this progress bar disappear. Simple, no?

Let’s see this in action with an example. Let’s say you have a reporting application, in which the user asks for a report, inputs the necessary parameters for the report, and then hits the submit button. Your ASP page goes to work generating the report and then outputs the data?after a very long time. During this time, you want your user to view the progress bar. This is how you would do it….

  1. Make sure your ASP page (the one that does the processing) outputs the top Title of your report. In this space, we will also include an image as follows:

    Generating Report, Please Wait... A Sample Activity Report

  2. In the above code, the points to a special animated GIF (rpt_prog_bar.gif). This image has been created to give the effect of a progress bar in motion. This is what it looks like:

  3. Continue your processing, outputting your data as and when it is ready. During all that processing, your user is viewing the progress-bar GIF and is therefore occupied.

  4. When you have finished your processing, and your data is sent back to the browser, the page’s ONLOAD function kicks in. In the tag, you have specified a piece of JavaScript code that makes your image disappear. This is done with this line of code:

What happens is that when the page is done processing, and all data has reached the browser, the animated GIF is replaced by a different GIF?a blank, single pixel GIF that essentially makes the animated GIF disappear! And voilá, when your page is in processing stage, you have a progress bar. When the processing is done, it disappears.

To see a working example of this, browse to www15.brinkster.com/theasppro/10minProgress.asp. Click on the link at the bottom to view the Sneaky ASP Trick in action.

devxblackblue

About Our Editorial Process

At DevX, we’re dedicated to tech entrepreneurship. Our team closely follows industry shifts, new products, AI breakthroughs, technology trends, and funding announcements. Articles undergo thorough editing to ensure accuracy and clarity, reflecting DevX’s style and supporting entrepreneurs in the tech sphere.

See our full editorial policy.

About Our Journalist