Creating a C1Dialog Control in Code

Creating a C1Dialog control in code is an easy process. In this topic, you will add a PlaceHolder control to the page, add an import statement, customize the C1Dialog control, and add the control to the PlaceHolder.

Complete the following steps:

  1. In Design View, navigate to the Visual Studio Toolbox and add a PlaceHolder control to the page.
  2. Double-click the page to add a Page_Load event and switch to Code view.
  3. 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.C1Dialog
    

    To write code in C#

    C#
    Copy Code
    using C1.Web.Wijmo.Controls.C1Dialog;
    
  4. Add the following code to the Page_Load event to create the control, set C1Dialog's height and width, and add the control to the PlaceHolder.

    To write code in Visual Basic

    Visual Basic
    Copy Code
    'Create a new C1Dialog
    Dim C1D As New C1Dialog()
    
    'Set the control's size
    C1D.Height = 200
    C1D.Width = 200
    
    'Add the control to the PlaceHolder
    PlaceHolder1.Controls.Add(C1D)
    

    To write code in C#

    C#
    Copy Code
    //Create a new C1Dialog
    C1Dialog C1D = new C1Dialog();
    
    //Set the control's size
    C1D.Height = 200;
    C1D.Width = 200;
    
    //Add the C1Dialog to the PlaceHolder control
    PlaceHolder1.Controls.Add(C1D);