
78
|
Chapter 5: ASP.NET Server Controls
This is the Title of the Book, eMatter Edition
Copyright © 2008 O’Reilly & Associates, Inc. All rights reserved.
instance of the Placeholder class and gives it the same name (ID) as the control
declared in the Web Forms page. This allows the code in the code-behind page to
manipulate the control at runtime. Also note that this control instance is declared
as a protected member, which means that only code within the code-behind class
(or classes that inherit from it, including the Web Forms page in Example 5-3) can
access it.
Types of Web Controls
Web controls fall into eight categories: input, display, action, selection,
databound, rich, validation, and mobile.
Input Controls
Input controls let the user enter text data into the application. ASP.NET supports
only one input web control: the TextBox. The TextBox behaves like a single-line
or multiline edit control, depending on the value of its TextMode property. Its
simplified syntax is as follows:
<asp:textbox id="SingleText"
text="Single Line TextBox"
runat="server" />
<asp:textbox id="PasswordText"
text="Password"
textmode="Password"
runat="server" />
Example 5-4. ProgControl_cb.cs
using System;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
namespace aspnetian
{
public class ProgControl:Page
{
protected PlaceHolder PH = new PlaceHolder( );
void Page_Load( )
{
// The placement of the Placeholder ...