Task-Based Help > Creating a C1Expander in Code |
Creating a C1Expander control in code is fairly simple. In the following steps you'll add a PlaceHolder control to the page, add an import statement, add and customize the C1Expander, and add the control to the PlaceHolder.
Complete the following steps:
To write code in Visual Basic
Visual Basic |
Copy Code
|
---|---|
Imports C1.Web.Wijmo.Controls.C1Expander |
To write code in C#
C# |
Copy Code
|
---|---|
using C1.Web.Wijmo.Controls.C1Expander; |
Add the following code to the Page_Load event to create and customize the C1Expander control.
To write code in Visual Basic
Visual Basic |
Copy Code
|
---|---|
' Create a new C1Expander. Dim C1E As New C1Expander ' Set the control's size, appearance, and content. C1E.VisualStyle = "Office2007Blue" C1E.Height = 200 C1E.Width = 200 C1E.ContentUrl = "http://www.wikipedia.com/" ' Add the C1Expander to the PlaceHolder control. PlaceHolder1.Controls.Add(C1E) |
To write code in C#
C# |
Copy Code
|
---|---|
// Create a new C1Expander. C1Expander C1E = new C1Expander(); // Set the control's size, appearance, and content. C1E.VisualStyle = "Office2007Blue"; C1E.Height = 200; C1E.Width = 200; C1E.ContentUrl = "http://www.wikipedia.com/"; // Add the C1Expander to the PlaceHolder control. PlaceHolder1.Controls.Add(C1E); |
What You've Accomplished
Run your application and observe that the C1Expander control was created and displays external content: