ProgressBar for ASP.NET Web Forms
Setting C1ProgressBar Values
Task-Based Help > Setting C1ProgressBar Values

The C1ProgressBar control contains a minimum value, a maximum value, and a value. In this topic, you will change the value of the MinValueMaxValue, and Value properties from their defaults (0, 100, and 0 respectively) in Design view, in Source view, and in code.

Setting Values in Design View

Complete the following steps:

1.Click the Design button to enter Design view.

2. Right-click the C1ProgressBar control to open its context menu and select Properties. The Properties window opens with the C1ProgressBar control's properties in focus.

3. In the Properties window, set the following properties:

4. Press F5 to run the project and observe that the progress indicator has progressed along a quarter of the task bar. It has increased by a quarter because the control's value (150) is one-quarter of the way between the minimum value (100) and the maximum value (300).

Setting Values in Source view

Complete the following steps:

  1. Click the Source button to enter Source view.
  2. Add MinimumValue='100', MaximumValue='300', and <cc1:C1ProgressBar> tag so that the markup resembles the following:
    <cc1:C1ProgressBar ID="C1ProgressBar1" runat="server" ToolTip="Maximum value: {5}" LabelFormatString="{0}" MaximumValue="300" MinimumValue="100" Value="150" />
  3. Press F5 to run the project and observe that the progress indicator has progressed along a quarter of the task bar. It has increased by a quarter because the control's value (150) is one-quarter of the way between the minimum value (100) and the maximum value (300).

Setting Values in Code

Complete the following steps:

  1. To configure animations, complete the following steps:
  2. On the Visual Studio toolbar, click View | Code to enter code view.
  3. To set the MaxValue property, add the following code to the Page_Load event:

    Visual Basic

    Visual Basic
    Copy Code
    C1ProgressBar1.MaxValue = 300

    C#

    C#
    Copy Code
    C1ProgressBar1.MaxValue = 300;
  4. To set the MinValue property, add the following code to the Page_Load event:

    Visual Basic

    Visual Basic
    Copy Code
    C1ProgressBar1.MinValue = 100

    C#

    C#
    Copy Code
    C1ProgressBar1.MinValue = 100;
  5. To set the Value property, add the following code to the Page_Load event:

    Visual Basic

    Visual Basic
    Copy Code
    C1ProgressBar1.Value = 150

    C#

    C#
    Copy Code
    C1ProgressBar1.Value = 150;
  6. Press F5 to run the project and observe that the progress indicator has progressed along a quarter of the task bar. It has increased by a quarter because the control's value (150) is one-quarter of the way between the minimum value (100) and the maximum value (300).