ComponentOne Tabs for ASP.NET WebForms
Task-Based Help / Adding and Manipulating Tab Page Content / Adding Controls to C1Tabs
In This Topic
    Adding Controls to C1Tabs
    In This Topic

    You can add arbitrary controls to each of your C1Tabs's tab pages using a simple drag-and-drop operation, XHTML, or code. This topic illustrates how to add a standard Button control to a tab page This topic assumes you have added at least one tab page to the control (see Adding Tab Pages to the C1Tabs Control).

    In Design View

    Complete the following steps:

    1. In the designer, select the tab you wish to add the control to. To select a tab, select the C1Tabs control and then click on the tab.
    2. Select a Button control from the Visual Studio Toolbox and then drag it onto the C1TabPage.

    In Source View

    Complete the following steps:

    1. Locate the <cc1:C1TabPage> tag for the tab page you wish to add the control to and place the following tag between them:
    2. Run the program and observe that a Button control appears on the tab page.

    In Code

    Complete the following steps:

    1. Create a Button control and add text to it by entering the following code to the Page_Load event:

      To write code in Visual Basic

      Visual Basic
      Copy Code
      Dim nuButton As Button = New Button()
      nuButton.Text = "Hello World!"
      

      To write code in C#

      C#
      Copy Code
      Button nuButton = new Button();
      nuButton.Text = "Hello World!";
      
    2. Add the Button control to the tab page:

      To write code in Visual Basic

      Visual Basic
      Copy Code
      C1TabPage1.Controls.Add(nuButton)
      

      To write code in C#

      C#
      Copy Code
      C1TabPage1.Controls.Add(nuButton);
      
    3. Run the program and observe that a Button control appears on the tab page.
    See Also