ComponentOne Wizard for ASP.NET WebForms
Task-Based Help / Creating a C1Wizard Control in Code
In This Topic
    Creating a C1Wizard Control in Code
    In This Topic

    In some instances, you may want to add a C1Wizard control to your project in code. In this topic, you will learn how to create a C1Wizard control with two C1WizardStep objects using C# and Visual Basic code.

    Complete the following steps:

    1. Add a PlaceHolder control to your page.
    2. In Design view, double-click the page to add a Page_Load event to the project and to switch to the code editor.
    3. Import the following namespace into your project:

      To write code in Visual Basic

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

      To write code in C#

      C#
      Copy Code
      using C1.Web.Wijmo.Controls.C1Wizard;
      
    4. Create the C1Wizard object, set its Width and Height, and then add it to your project by placing the following code in the Page_Load event:

      To write code in Visual Basic

      Visual Basic
      Copy Code
      Dim NewWizard As C1Wizard = New C1Wizard() 
      NewWizard.Width = 300
      NewWizard.Height = 200
      PlaceHolder1.Controls.Add(NewWizard)
      

      To write code in C#

      C#
      Copy Code
      C1Wizard NewWizard = new C1Wizard();
      NewWizard.Width = 300;
      NewWizard.Height = 200;
      PlaceHolder1.Controls.Add(NewWizard); 
      
    5. Create three C1WizardStep objects and add them to the C1Wizard. This code should also be added to the Page_Load event.

      To write code in Visual Basic

      Visual Basic
      Copy Code
      'Create three C1WizardStep objects
      
      Dim C1WizardStep1 As C1WizardStep = New C1WizardStep() 
      Dim C1WizardStep2 As C1WizardStep = New C1WizardStep() 
       
      
      'Set the WizardSteps' 'Text' Property
      
      C1WizardStep1.Title = "C1WizardStep1"
      C1WizardStep2.Title = "C1WizardStep2"
       
      
      'Add the three C1WizardStep objects to the C1Wizard
      
      NewWizard.Controls.Add(C1WizardStep1)
      NewWizard.Controls.Add(C1WizardStep2)
      

      To write code in C#

      C#
      Copy Code
      //Create three C1WizardStep objects
      
      C1WizardStep C1WizardStep1 = new C1WizardStep();
      C1WizardStep C1WizardStep2 = new C1WizardStep();
       
      //Set the WizardSteps' 'Text' Property'
      
      C1WizardStep1.Title = "C1WizardStep1";
      C1WizardStep2.Title = "C1WizardStep2";
       
      //Add the three C1WizardStep objects to the C1Wizard
      
      NewWizard.Controls.Add(C1WizardStep1);
      NewWizard.Controls.Add(C1WizardStep2); 
      
    6. Run the program.

    Description: CheckThis topic illustrates the following:

    When your project is run, your C1Wizard control will resemble the following image:

    Description: D:\Whidbey\T211\Projects - ASP Wijmo\Wijmo_C1Wizard\Word Documents\WizardTBH\CreatingInCode_Final.png

    See Also