In this topic, you will learn how to add an arbitrary control to the content area of the C1ViewPort control in Design view, in Source view, and in code. This topic assumes that you have created an AJAX-enabled ASP.NET project that contains a ScriptManager control (see Creating an AJAX-Enabled ASP.NET Project) and a C1ViewPort control.
Tip: You can easily space arbitrary controls on the
C1ViewPort control by adding a table to the content area of
the control.
In Design View
Complete the following steps:
1. Place your cursor in the content area of the C1ViewPort control.
2. In the Toolbox, select a standard Button control and drag it into the content area of the C1ViewPort control.
A Button control appears in the content area of the C1ViewPort control.
In Source View
To add arbitrary controls to the content area, place the following XHTML markup between the <cc1:C1ViewPort> and </cc1:C1ViewPort> tags:
<Content>
<asp:Button ID="Button1" runat="server" Text="Button" />
</Content>
In Code
Complete the following steps:
1. Import the following namespace into your project:
Imports C1.Web.iPhone.C1ViewPort
•C#
using C1.Web.iPhone.C1ViewPort;
2. Create the standard Button object and set its Text property by placing the following code in the Page_Load event:
Dim Button1 As New Button()
Button1.Text = "Button"
•C#
Button Button1 = new Button();
Button1.Text = "Button";
3. Add the Button object to the C1ViewPort control by placing the following code in the Page_Load event:
C1ViewPort1.ContentPanel.Controls.Add(Button1)
•C#
C1ViewPort1.ContentPanel.Controls.Add(Button1);
4. Save the project and open it in a Studio for iPhone-compatible browser to execute the program.
This Topic
Illustrates the Following:
In this topic, you added an arbitrary control (a standard Button control) to the content area of the C1ViewPort control. The result of this topic will resemble the following image: