ComponentOne RadialGauge for ASP.NET Web Forms
C1RadialGauge Concepts / Task-Based Help / Creating a C1RadialGauge in Code
In This Topic
    Creating a C1RadialGauge in Code
    In This Topic

    Creating a C1RadialGauge control in code is fairly simple. In the following steps you'll add a PlaceHolder control to the page, add an import statement, add and customize the C1RadialGauge, and add the control to the PlaceHolder.

    Complete the following steps:

    1. In Design view, double-click the page to create the Page_Load event and switch to Code view.
    2. Add the following statement to the top of the Code Editor to import the appropriate namespace:

      To write code in Visual Basic

      Visual Basic
      Copy Code
      Imports C1.Web.Wijmo.Controls.C1Gauge

      To write code in C#

      C#
      Copy Code
      using C1.Web.Wijmo.Controls.C1Gauge;
    3. Add the following code to the Page_Load event to create and customize the C1RadialGauge control.        

      To write code in Visual Basic

      Visual Basic
      Copy Code

      ' Create a new C1RadialGauge.
        Dim C1RG As New C1RadialGauge
       

      ' Set the control's size and value.
        C1RG.Height = 200
        C1RG.Width = 200
        C1RG.Min = 0
        C1RG.Max = 100
        C1RG.Value = 60
       

      ' Add the C1RadialGauge to the PlaceHolder control.
        Dim PlaceHolder1 As New PlaceHolder
        PlaceHolder1.Controls.Add(C1RG)
        form1.Controls.Add(PlaceHolder1)

      To write code in C#

      C#
      Copy Code

      // Create a new C1RadialGauge.
         C1RadialGauge C1RG = new C1RadialGauge();

      // Set the control's size and value.
         C1RG.Height = 200;
         C1RG.Width = 200;
         C1RG.Min = 0;
         C1RG.Max = 100;
         C1RG.Value = 60;

      // Add the C1RadialGauge to the PlaceHolder control.
         PlaceHolder PlaceHolder1 = new PlaceHolder();
         PlaceHolder1.Controls.Add(C1RG);
         form1.Controls.Add(PlaceHolder1);

    What You've Accomplished

    Run your application and observe that the C1RadialGauge control was created.

    See Also