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

  • With 81% of employees using their phones at work, companies have stopped asking: "Is corporate data leaking from personal devices?" and started asking: "How do we effectively prevent corporate data from leaking from personal devices?" The answer has not been simple. ZixOne raises the bar on BYOD security by not allowing email data to reside on the device. In addition, Zix allows employees to maintain complete control of their personal device, therefore satisfying privacy demands of valued employees and the …

  • If you need new tools and tricks to make your meetings profitable and productive, then 5 Tips in 5 Minutes: A Quick Guide for More Profitable Sales Meetings is for you. Timely, practical tips that you can incorporate in just seconds will save you literally hours in travel and meeting time, not to mention help you to focus on what your sales prospects really want to know and how you can meet their needs. Get 5in5: A Quick Guide for More Profitable Sales Meetings and start building your sales the smarter, faster …

Most Popular Programming Stories

More for Developers

Latest Developer Headlines

RSS Feeds