Sams Teach Yourself ASP.NET in 21 Days, Second Edition By Chris Payne
Table of Contents
Week 3. At a Glance
This appendix covers the properties and methods for every ASP.NET server control, including HTML server controls, Web server controls, and validation controls. Also refer to the .NET Framework SDK Documentation for further reference.
All of the following controls inherit the properties described in Table C.1 from the System.Web.UI.Control class.
Table C.1. Properties of the Control Class Inherited by All Server Controls
Property
Description
ClientID
The ID generated for the control by ASP.NET.
Controls
Returns a ControlCollection object that represents all the child controls for the specified control.
EnableViewState
Specifies whether the control should maintain its viewstate and the viewstate of any child controls.
ID
Specifies the identifier for the control. This property must be present to enable programmatic control and event handling.
NamingContainer
Retrieves a reference to the control's naming container.
Page
Gets the Page object that contains the control.
Parent
Gets the control's parent in the UI hierarchy.
Site
Specifies the site information for the control.
TemplateSourceDirectory
Specifies the virtual directory of the page that contains the control.
UniqueID
Specifies the unique, hierarchically qualified identity for the control. This differs from ID because it includes the full object hierarchy of the control.
Visible
Specifies whether the control should render on the page.
Table C.2 lists the methods shared by all server controls, inherited from the Control object.
Table C.2. Methods of the Control Class Inherited by All Server Controls
Method
Description
DataBind
Binds data to the specified control.
Dispose
Performs any final cleanup before the control is destroyed.
FindControl
Searches the current container control for a control specified by string. Returns a Control object.
HasControls
Indicates whether the control has any children.
RenderControl
Outputs control content to an HtmlTextWriter object specified by writer.
ResolveUrl
Resolves a relative URL to an absolute URL based on the value passed to the TemplateSourceDirectory property.
Table C.3 lists the events shared by all server controls, inherited from the Control object.
Table C.3. Events of the Control Class Inherited by All Server Controls
Event
Description
DataBinding
Occurs when data is bound to the control.
Disposed
Occurs when the control is released from memory.
Init
Occurs when the control is initialized (this is the first step).
Load
Occurs when the control is loaded to the Page object.
PreRender
Occurs immediately before the control is rendered.