This topic illustrates how to add a back button to the C1ViewPort control's navigation bar 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.
Note: Back buttons won't appear at run time unless you arrived at a page from a link on a previous page.
In Design View
Complete the following steps:
1. Right-click the C1ViewPort control to open its context menu and then select Properties from the list.
The Properties window opens with C1ViewPort's properties in focus.
2. Expand the node for the LeftButton property and set the following properties:
• Set the ID property to "Home".
• Set the Text property to "Home".
• Set the ButtonType property to Back.
3. Save the project and open it in a Studio for iPhone-compatible browser.
In Source View
Complete the following steps:
1. Place <LeftButton ButtonType="Back" Text="Home" CssClass="C1LeftButton" id="Home"></LeftButton> between the <cc1:C1ViewPort> and </cc1:C1ViewPort> tags so that the markup resembles the following:
<cc1:C1ViewPort ID="C1ViewPort1" runat="server" Height="507px" ToolBarVisible="False" Width="320px">
<LeftButton ButtonType="Back" Text="Home" CssClass="C1LeftButton" id="Home"></LeftButton>
</cc1:C1ViewPort>
2. Save the project and open it in a Studio for iPhone-compatible browser.
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. Add the following code to the Page_Load event to set the ID property:
C1ViewPort1.LeftButton.ID = "Home"
•C#
C1ViewPort1.LeftButton.ID = "Home";
3. Add the following code to the Page_Load event to set the Text property:
C1ViewPort1.LeftButton.Text = "Home"
•C#
C1ViewPort1.LeftButton.Text = "Home";
4. Add the following code to the Page_Load event to set the ButtonType property:
C1ViewPort1.LeftButton.ButtonType = C1.Web.iPhone.C1Button.C1ButtonType.Back
•C#
C1ViewPort1.LeftButton.ButtonType = C1.Web.iPhone.C1Button.C1ButtonType.Back;
5. 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 a back button to the header bar. The result should resemble the following image: