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

  • On-demand Event Event Date: September 10, 2014 Modern mobile applications connect systems-of-engagement (mobile apps) with systems-of-record (traditional IT) to deliver new and innovative business value. But the lifecycle for development of mobile apps is also new and different. Emerging trends in mobile development call for faster delivery of incremental features, coupled with feedback from the users of the app "in the wild." This loop of continuous delivery and continuous feedback is how the best mobile …

  • QA teams don't have time to test everything yet they can't afford to ship buggy code. Learn how Coverity can help organizations shrink their testing cycles and reduce regression risk by focusing their manual and automated testing based on the impact of change.

Most Popular Programming Stories

More for Developers

Latest Developer Headlines

RSS Feeds