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

  • Live Event Date: October 29, 2014 @ 11:00 a.m. ET / 8:00 a.m. PT Are you interested in building a cognitive application using the power of IBM Watson? Need a platform that provides speed and ease for rapidly deploying this application? Join Chris Madison, Watson Solution Architect, as he walks through the process of building a Watson powered application on IBM Bluemix. Chris will talk about the new Watson Services just released on IBM bluemix, but more importantly he will do a step by step cognitive …

  • Protecting business operations means shifting the priorities around availability from disaster recovery to business continuity. Enterprises are shifting their focus from recovery from a disaster to preventing the disaster in the first place. With this change in mindset, disaster recovery is no longer the first line of defense; the organizations with a smarter business continuity practice are less impacted when disasters strike. This SmartSelect will provide insight to help guide your enterprise toward better …

Most Popular Programming Stories

More for Developers

Latest Developer Headlines

RSS Feeds