Network programming in C#, Network Programming in VB.NET, Network Programming in .NET
Available now!
Buy at Amazon US or
Buy at Amazon UK



Articles

1.Windows API reference
2.HTML to WML Converter
3.Webcam streaming in VB.NET
4.Remoting with firewalls
5.RSA from first principles
6.Key & MouseLogger in .NET
7.Networking Resource Kit for .NET
8.Automatic Reboot with .NET
9.XAML Schema
10.Migrating VB6 Winsock to VB.NET
11.Migrating C++ sockets to C#
12.RFC Reference guide
13.Lingua - Localization webservice
14.COM Reference guide
15.WMI Reference guide
16.SQL stored procedures
17.TCP & UDP port reference
18..NET Framework reference
19.Ethernet Type codes
20.IP to country webservice
21.MAC address assignments
22.DLL entry point reference
23.WHOIS server list
24. Turing Numbers
25. Boost SQL performance
26. Progress Bar in ASP.NET
27. OleDb WebService
27. Internet Explorer

Contact us

Progress bar in ASP.NET



Oftentimes, when your asp.net page is carrying out a lengthy procedure, you have to resort to showing your users a "please wait" page. This may help, but if the user sees no noticible progress, they may get bored, press the back button, refresh, or close the browser. You could use an animated gif, or javascript, but this does not reflect what the server is doing, and is never going to give an accurate indication of how much is left to do.

Progress bar by Network.Programming-in.net
   

Dynamic Label by Network.Programming-in.net

The below progress bar is controlled by SERVER SIDE code, and not purely javascript. Acompanying it is a special server-side controlled dynamic label, which can be changed dynamically to reflect progress, or current activities.

To use this control:

  • Download the following DLL: DynamicASP.Zip (47Kb)
  • Unzip the files into your /Bin folder.
  • Add a reference to the top of your asp.net page:
      <%@ Page Language="C#" Debug="true" %>
    <%@ Register TagPrefix="DynamicASP" 
        Namespace="DynamicASP" 
        Assembly="DynamicASP"
    %>
      
  • Add the following code in your asp.net page at the point where you want the progress bar to appear:
       <DynamicASP:ProgressBar id="pbProgess" runat="server" />
      
  • If you would like an accompanying label, add the following to the page:
       <DynamicASP:Label id="dlblText" runat="server" />
      
  • To demonstrate th controls in action, add some in-line code to the foot of your asp.net (aspx) page as follows:
    <%
     int i=0;
     for (i=0;i<=100;i++)
     {
      dlblText1.Text="Progress:" + i + "%";
      pbProgess.Value=i;
      Thread.Sleep(100);
     }
    %>
      
Extra stuff that I might want to keep for reference: Compiling: erase C:\Inetpub\wwwroot\progressBar.net\bin\DynamicASP.DLL "c:\windows\microsoft.net\framework\v1.1.4322\csc.exe" /t:library /utf8output /R:"c:\windows\assembly\gac\system.web.services\1.0.5000.0__b03f5f7f11d50a3a\system.web.services.dll" /R:"c:\windows\assembly\gac\system.xml\1.0.5000.0__b77a5c561934e089\system.xml.dll" /R:"c:\windows\assembly\gac\system.web.mobile\1.0.5000.0__b03f5f7f11d50a3a\system.web.mobile.dll" /R:"c:\windows\assembly\gac\system.drawing\1.0.5000.0__b03f5f7f11d50a3a\system.drawing.dll" /R:"c:\windows\assembly\gac\system.data\1.0.5000.0__b77a5c561934e089\system.data.dll" /R:"c:\windows\assembly\gac\system.enterpriseservices\1.0.5000.0__b03f5f7f11d50a3a\system.enterpriseservices.dll" /R:"c:\windows\microsoft.net\framework\v1.1.4322\mscorlib.dll" /R:"c:\windows\assembly\gac\system.web\1.0.5000.0__b03f5f7f11d50a3a\system.web.dll" /R:"c:\windows\assembly\gac\system\1.0.5000.0__b77a5c561934e089\system.dll" /out:"C:\Inetpub\wwwroot\progressBar.net\bin\DynamicASP.DLL" /D:DEBUG /debug+ /w:4 /doc:"C:\Inetpub\wwwroot\progressBar.net\bin\DynamicASP.xml" "C:\Inetpub\wwwroot\progressBar.net\control\dynamicLabel.cs" DynamicASP This class is used to display a progress bar to indicate the progress of borderColor determines the colour of the border surrounding the bar, default is #000000 - black fillColor determines the colour of the filled bar, default is #000000 - black unfilledColor determines the colour of the unfilled part of the bar, default is #FFFFFF - white Render is called whenever the control is declared on the page. Do not reverse-engineer this method. Maximum determines the maximum value of the progress bar. Default is 100. must be greater than minimum Minimum determines the Minimum value of the progress bar. Default is 0. must be less than maximum. Value determines the actual value of the progress bar. It must fall within Minimum and Maximum. For full effect, it should be called from in-line code at the footer of the page. This class is used to display a label whose contents can be changed after it has rendered on the clients web browser. This is useful for showing server activity Dynamicaly on web browser without redirecting the page. i.e. "Registering domain name www.xyx.com ... complete" "Allocating web space for www.xyx.com ..." "Adding default web page content ..." "Submitting website to search engines ... www.google.com (1/100)" "Submitting website to search engines ... www.altavista.com (2/100)" Render is called whenever the control is declared on the page. Do not reverse-engineer this method. the Text property determines the contents of the label, if may contain HTML if required. For full effect, the .Text property should be called from the foot of the page, in in-line code. see http://network.programming-in.net for full details.



Google

© 2008 Free SMS| Sage Line 50 Component