ComponentOne Splitter for ASP.NET AJAX: Splitter for ASP.NET AJAX Task-Based Help > Adding Content to the Splitter Panels > Adding Arbitrary Controls to C1Splitter

Adding Arbitrary Controls to C1Splitter

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.

 

      Description: D:\Whidbey\T109\C1Splitter\WordDocuments\TBH\AddingArbitraryControls_AddButtonPanel1.png

 

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

 

      Description: D:\Whidbey\T109\C1Splitter\WordDocuments\TBH\AddingArbitraryControls_AddTextBoxPanel2.png

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:

      Visual Basic

Dim nuButton As Button =  New Button()

nuButton.Text = "Hello World!"

      C#

Button nuButton = new Button();

nuButton.Text = "Hello World!";

6.   Create a TextBox control:

      Visual Basic

Dim nuTextBox As TextBox = New TextBox()

      C#

TextBox nuTextBox = new TextBox();

7.   Add the Button control to the PlaceHolder1:

      Visual Basic

PlaceHolder1.Controls.Add(nuButton)

      C#

PlaceHolder1.Controls.Add(nuButton);

8.   Add the TextBox control to PlaceHolder2:

      Visual Basic

PlaceHolder2.Controls.Add(nuTextBox)

      C#

PlaceHolder2.Controls.Add(nuTextBox);

9.   Run the program.

Description: D:\Whidbey\T109\C1Splitter\WordDocuments\Other Graphics\10.pngThis Topic Illustrates the Following:

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

 

Description: D:\Whidbey\T109\C1Splitter\WordDocuments\TBH\AddingArbitraryControls_Final.png


Send comments about this topic to ComponentOne.
Copyright © 1987-2010 ComponentOne LLC. All rights reserved.