ComponentOne AutoComplete for ASP.NET Web Forms
Task-Based Help / Creating a C1AutoComplete Control in Code
In This Topic
    Creating a C1AutoComplete Control in Code
    In This Topic

    Creating a C1AutoComplete 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 C1AutoComplete 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.C1AutoComplete
      

      To write code in C#

      C#
      Copy Code
      using C1.Web.Wijmo.Controls.C1AutoComplete;
      
    4. Add the following code to the Page_Load event to create the control and add the control to the PlaceHolder.

      To write code in Visual Basic

      Visual Basic
      Copy Code
      'Create a new C1AutoComplete
      Dim C1A As New C1AutoComplete()
      'Add the control to the PlaceHolder
      PlaceHolder1.Controls.Add(C1A)
      

      To write code in C#

      C#
      Copy Code
      //Create a new C1AutoComplete
      C1AutoComplete C1A = new C1AutoComplete();
      //Add the C1AutoComplete to the PlaceHolder control
      PlaceHolder1.Controls.Add(C1A);