ASP.NET Version of "Progress Bar"

ASP.NET version of "Progress Bar"


This sample uses ASP.NET to create a progress bar type of display for use on a web page. It is implemented as a user control so that it's extremely simple to use. I've included five different styles implemented three different ways so you can choose whatever style you prefer.

When I started writing the ASP.NET version of our progress bar sample, I had some decisions to make. First off, ASP.NET includes plenty of graphical capabilities that classic ASP does not. This means that if we wanted to, we could generate the entire progress bar using ASP.NET and remove the reliance on the included images. I decided against this approach in order to keep things simple and to avoid adding any additional server processing.

The next decision was how to implement the actual code. It made sense to wrap things up into a user control, but with three different types of progress bar I didn't want things to get too confusing. I did decide to roll all three types (HTML, Smooth, and Chunked) into one control. To keep things simple I created a separate function to build each type. They're all pretty similar, but the details vary enough to make integrating them difficult. The Page_Load routine acts as a traffic cop of sorts and directs execution to the appropriate function based upon the style choosen.

Creating a new style is as simple as creating a new set of images, deciding on a name, and setting some properties in the control. If you take a look at the existing styles you'll see what I mean.

One last note: since the "IE-esque" style has the least user-friendly name, I've made it the default style. Any time the control is passed an unrecognized style name, it reverts back to the "IE-esque" style.

A zip file of the code (including the control and related images) (6.1 KB) is below.



About the Author

From ASP101

Articles originally posted on ASP101.com

Downloads

Comments

  • There are no comments yet. Be the first to comment!

Leave a Comment
  • Your email address will not be published. All fields are required.

Top White Papers and Webcasts

  • Packaged application development teams frequently operate with limited testing environments due to time and labor constraints. By virtualizing the entire application stack, packaged application development teams can deliver business results faster, at higher quality, and with lower risk.

  • Not long ago, security was viewed as one of the biggest obstacles to widespread adoption of cloud-based deployments for enterprise software solutions. However, the combination of advancing technology and an increasing variety of threats that companies must guard against is rapidly turning the tide. Cloud vendors typically offer a much higher level of data center and virtual system security than most organizations can or will build out on their own. Read this white paper to learn the five ways that cloud …

Most Popular Programming Stories

More for Developers

Latest Developer Headlines

RSS Feeds