ComponentOne Splitter for ASP.NET Web Forms
Task-Based Help / Adding Content to the Splitter Panels / Adding Arbitrary Controls to C1Splitter
In This Topic
    Adding Arbitrary Controls to C1Splitter
    In This Topic

    You can add arbitrary controls to each panel of the C1Splitter control using a simple drag-and-drop operation or HTML. In this topic, you will add a Button control to Panel1 and a TextBox control to Panel2.

    In Design View

    Complete the following steps:

    1. Add a C1Splitter control to your Web project.
    2. Select a Button control from the Visual Studio Toolbox and drag it into the Panel1.        

    3. Select a TextBox control from the Visual Studio Toolbox and drag it into Panel2

    In Source View

    Complete the following steps:

    1. Add a C1Splitter control to your Web project.
    2. Click the Source tab to enter Source view.
    3. Locate the <Panel1> tags and place the following tag between them:
      <ContentTemplate>
      <asp:Button ID="Button1" runat="server" Text="Button" />
      </ContentTemplate>
    4. Locate the <Panel2> tags and place the following tag between them:
      <ContentTemplate>
      <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
      </ContentTemplate>

    In Code

    Complete the following steps:

    1. Add a C1Splitter control to your Web project.
    2. Select a PlaceHolder control from the Visual Studio Toolbox and drag it into the Panel1.
       PlaceHolder1 appears in Panel1.
    3. Select a PlaceHolder control from the Visual Studio Toolbox and drag it into the Panel2.
       PlaceHolder2 appears in Panel2.
    4. In the Solution Explorer window, right-click on the project and select View Code to enter the code editor.
    5. Create a Button control and add text to it by entering the following code to the Page_Load event:

      To write the code in Visual Basic:

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

      To write the code in C#:

        
      C#
      Copy Code
      Button nuButton = new Button();
       nuButton.Text = "Hello World!";
    6. Create a TextBox control:

      To write the code in Visual Basic:

        
      Visual Basic
      Copy Code
      Dim nuTextBox As TextBox = New TextBox()

      To write the code in C#:

        
      C#
      Copy Code
      TextBox nuTextBox = new TextBox();
    7. Add the Button control to the PlaceHolder1:

      To write the code in Visual Basic:

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

      To write the code in C#:

        

      C#
      Copy Code

      PlaceHolder2.Controls.Add(nuTextBox);

    8. Add the TextBox control to PlaceHolder2:

      To write the code in Visual Basic:

      Visual Basic
      Copy Code
        PlaceHolder2.Controls.Add(nuTextBox)

      To write the code in C#:

        
      C#
      Copy Code
      PlaceHolder2.Controls.Add(nuTextBox);
    9. Run the program.

    This Topic Illustrates the Following:

    The following graphic depicts a C1Splitter control with a Button control in Panel1 and a TextBox control in Panel2.

     

    See Also