ASP.NET broadly classifies server-side controls into two categories:
* Rendering controls (controls that completely manage the rendering process)
* Composite controls (multiple server-side controls bundled into a single unit)
Sampling of the Page’s Properties, Methods, and Events
Application
Reference to the HttpApplicationState object associated with the current request
Cache
Reference to the application’s cache—an in-memory dictionary of application-wide state (usually for optimization)
Controls
The control collection maintained by Page
CreateChildControls
Virtual method during which the page constructs its control tree
Init
Event indicating the page has initialized
IsPostBack
Distinguishes the request as either a new request or a POST
Load
Event indicating the page has been loaded
RenderControl
Virtual method during which the page renders its contents
Request
Reference to a stateful object representing the incoming request
Response
Reference to a stateful object representing the outgoing response
Session
Reference to a stateful object representing information specific to the current request
Unload
Event indicating the page has unloaded
Other elements of the Control class include items such as the following:
* Properties for managing the control’s view state
* Properties for managing skins (to accommodate a consistent look and feel across multiple pages in a site)
* Properties for getting the parent control (in the case of composite controls) and the parent page
* Event handlers for the Init, Load, PreRender, and Unload events
* Methods for raising the Init, Load, PreRender, and Unload events
* Methods for managing child controls
Visual Studio creates a simple control that contains a single Text property, and it renders that Text property to the end browser. It’s a good way to discover how server-side controls work.
The following lines of code are what Visual Studio adds to the .aspx file to accommodate the control
<%@ Register
Assembly="CustomControlLib, Version=1.0.0.0,
Culture=neutral,
PublicKeyToken=null"
Namespace="CustomControlLib" TagPrefix="cc1" %>
<cc1:ServerControl1 ID="ServerControl11"
runat="server"
Text="When you set the control's property,
it shows up in the designer..." />
from microsoft asp.net 4 step by step
댓글 없음:
댓글 쓰기