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.

Share the Post:
Share on facebook
Share on twitter
Share on linkedin

Overview

The Latest

iOS app development

The Future of iOS App Development: Trends to Watch

When it launched in 2008, the Apple App Store only had 500 apps available. By the first quarter of 2022, the store had about 2.18 million iOS-exclusive apps. Average monthly app releases for the platform reached 34,000 in the first half of 2022, indicating rapid growth in iOS app development.

microsoft careers

Top Careers at Microsoft

Microsoft has gained its position as one of the top companies in the world, and Microsoft careers are flourishing. This multinational company is efficiently developing popular software and computers with other consumer electronics. It is a dream come true for so many people to acquire a high paid, high-prestige job

your company's audio

4 Areas of Your Company Where Your Audio Really Matters

Your company probably relies on audio more than you realize. Whether you’re creating a spoken text message to a colleague or giving a speech, you want your audio to shine. Otherwise, you could cause avoidable friction points and potentially hurt your brand reputation. For example, let’s say you create a