ComponentOne SuperPanel for ASP.NET AJAX: SuperPanel for ASP.NET AJAX Task-Based Help > Creating a C1SuperPanel in Code

Creating a C1SuperPanel in Code

Creating a C1SuperPanel control in code is fairly simple. In the following steps you'll add a PlaceHolder control to the page, declare the namespace, customize the C1SuperPanel, and add the control to the PlaceHolder.

Complete the following steps:

1.   In the Solution Explorer, right-click on your project name and select Add Reference. The Add Reference dialog box appears.

2.   In the Add Reference dialog box locate the C1.Web.UI.Controls.2.dll and click OK to add the C1.Web.UI.Controls.2.dll reference to your project.

3.   In Design view, navigate to the Visual Studio Toolbox and add a PlaceHolder control to your page.

4.   Delcare the C1.Web.UI.Controls.C1SuperPanel namespace directive in your code file at the top of the page.

      Visual Basic

Imports C1.Web.UI.Controls.C1SuperPanel

      C#

using C1.Web.UI.Controls.C1SuperPanel;

5.   Add the following code to the Page_Load event to create and customize the C1SuperPanel control.

      Visual Basic

' Create a new C1SuperPanel.

Dim C1SP As New C1SuperPanel

' Set the control's size, appearance, and content.

C1SP.VisualStyle = "Office2007Blue"

C1SP.Height = 200

C1SP.Width = 200

' Add the C1SuperPanel to the PlaceHolder control.

PlaceHolder1.Controls.Add(C1SP)

      C#

// Create a new C1SuperPanel.

C1SuperPanel C1SP = new C1SuperPanel();

// Set the control's size, appearance, and content.

C1SP.VisualStyle = "Office2007Blue";

C1SP.Height = 200;

C1SP.Width = 200;

// Add the C1SuperPanel to the PlaceHolder control.

PlaceHolder1.Controls.Add(C1SP);

Run your application and observe:

The C1SuperPanel control appears on your page:

 


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