This documentation is archived and is not being maintained.
This documentation is archived and is not being maintained.
Control Members
Control overview
Public Constructors Public Properties ClientID Gets the server control identifier generated by ASP.NET. Controls Gets a ControlCollection object that represents the child controls for a specified server control in the UI hierarchy. EnableViewState Gets or sets a value indicating whether the server control persists its view state, and the view state of any child controls it contains, to the requesting client. ID Gets or sets the programmatic identifier assigned to the server control. NamingContainer Gets a reference to the server control's naming container, which creates a unique namespace for differentiating between server controls with the same Control.ID property value. Page Gets a reference to the Page instance that contains the server control. Parent Gets a reference to the server control's parent control in the page control hierarchy. Site Gets information about the Web site to which the server control belongs. TemplateSourceDirectory Gets the virtual directory of the Page or UserControl that contains the current server control. UniqueID Gets the unique, hierarchically-qualified identifier for the server control. Visible Gets or sets a value that indicates whether a server control is rendered as UI on the page.
Public Methods DataBind Binds a data source to the invoked server control and all its child controls. Dispose Enables a server control to perform final clean up before it is released from memory. Equals (inherited from Object ) Overloaded. Determines whether two Object instances are equal. FindControl Overloaded. Searches the current naming container for the specified server control. GetHashCode (inherited from Object ) Serves as a hash function for a particular type, suitable for use in hashing algorithms and data structures like a hash table. GetType (inherited from Object ) Gets the Type of the current instance. HasControls Determines if the server control contains any child controls. RenderControl Outputs server control content to a provided HtmlTextWriter object and stores tracing information about the control if tracing is enabled. ResolveUrl Converts a URL into one that is usable on the requesting client. ToString (inherited from Object ) Returns a String that represents the current Object .
Public Events DataBinding Occurs when the server control binds to a data source. Disposed Occurs when a server control is released from memory, which is the last stage of the server control lifecycle when an ASP.NET page is requested. Init Occurs when the server control is initialized, which is the first step in the its lifecycle. Load Occurs when the server control is loaded into the Page object. PreRender Occurs when the server control is about to render to its containing Page object. Unload Occurs when the server control is unloaded from memory.
Protected Properties ChildControlsCreated Gets a value that indicates whether the server control's child controls have been created. Context Gets the HttpContext object associated with the server control for the current Web request. Events Gets a list of event handler delegates for the control. This property is read-only. HasChildViewState Gets a value indicating whether the current server control's child controls have any saved view-state settings. IsTrackingViewState Gets a value that indicates whether the server control is saving changes to its view state. ViewState Gets a dictionary of state information that allows you to save and restore the view state of a server control across multiple requests for the same page. ViewStateIgnoresCase Gets a value that indicates whether the StateBag object is case-insensitive.
Protected Methods AddedControl Called after a control is added to the Controls collection of another control. AddParsedSubObject Notifies the server control that an element, either XML or HTML, was parsed, and adds the element to the server control's ControlCollection object. ClearChildViewState Deletes the view-state information for all the server control's child controls. CreateChildControls Notifies server controls that use composition-based implementation to create any child controls they contain in preparation for posting back or rendering. CreateControlCollection Creates a new ControlCollection object to hold the child controls (both literal and server) of the server control. EnsureChildControls Determines whether the server control contains child controls. If it does not, it creates child controls. Finalize (inherited from Object ) Overridden. Allows an Object to attempt to free resources and perform other cleanup operations before the Object is reclaimed by garbage collection.
In C# and C++, finalizers are expressed using destructor syntax.
IsLiteralContent Determines if the server control holds only literal content. LoadViewState Restores view-state information from a previous page request that was saved by the SaveViewState method. MapPathSecure Retrieves the physical path that a virtual path, either absolute or relative, maps to. MemberwiseClone (inherited from Object ) Creates a shallow copy of the current Object . OnBubbleEvent Determines whether the event for the server control is passed up the page's UI server control hierarchy. OnDataBinding Raises the DataBinding event. OnInit Raises the Init event. OnLoad Raises the Load event. OnPreRender Raises the PreRender event. OnUnload Raises the Unload event.
Note Server controls should perform any final cleanup, such as closing files, closing database connections, and discarding objects, during this stage of the server control lifecycle. RaiseBubbleEvent Assigns any sources of the event and its information to the control's parent. RemovedControl Called after a control is removed from the Controls collection of another control. Render Sends server control content to a provided HtmlTextWriter object, which writes the content to be rendered on the client. RenderChildren Outputs the content of a server control's children to a provided HtmlTextWriter object, which writes the content to be rendered on the client. SaveViewState Saves any server control view-state changes that have occurred since the time the page was posted back to the server. TrackViewState Causes tracking of view-state changes to the server control so they can be stored in the server control's StateBag object. This object is accessible through the Control.ViewState property.
See Also Control Class | System.Web.UI Namespace