ProgressBar for ASP.NET Web Forms
Step 2 of 3: Configuring the Controls
Quick Start > Step 2 of 3: Configuring the Controls

In this step, you will specify the StartTaskButton and StopTaskButton, which will designate the button controls as the buttons that will start and stop the progress bar updating process.

  1. Select the C1ProgressBar control and in the Visual Studio Properties window, click the drop-down arrow next to StartTaskButton and select Button1.
  2. Set the StopTaskButton property to Button2.
  3. In the Properties window, click the Events button to list all of the events for the C1ProgressBar1 control.

    Next to the RunTask event, enter ProgressBar1_RunTask. This creates an event in Code view, where you can enter the following code, so the event looks like this:

    Visual Basic

    Visual Basic
    Copy Code
    Protected Sub ProgressBar1_RunTask(sender As Object, e As C1.Web.Wijmo.Controls.C1ProgressBar.C1ProgressBarTaskEventArgs)
      For i As Integer = 0 To 99
           System.Threading.Thread.Sleep(500)
           e.UpdateProgress(i)
      Next
    End Sub

    C#

    C#
    Copy Code
    protected void ProgressBar1_RunTask(object sender, C1.Web.Wijmo.Controls.C1ProgressBar.C1ProgressBarTaskEventArgs e)
    {
          for (int i = 0; i < 100; i++)
          {
              System.Threading.Thread.Sleep(500);
              e.UpdateProgress(i);
          }
    }

    When the Start button is clicked, the RunTask event fires and calls the UpdateProgress method to update the progress bar by 1 integer every 500 milliseconds.

See Also