Content Class
Assembly: System.Web (in system.web.dll)
A Content control is a container for the content and controls of a content page. A Content control is used only with a master page that defines a corresponding ContentPlaceHolder control. A Content control is not added to the control hierarchy at runtime. Instead, the contents within the Content control are directly merged into the corresponding ContentPlaceHolder control.
The Content control is associated with a ContentPlaceHolder using its ContentPlaceHolderID property. Set the ContentPlaceHolderID property to the value of the ID property of a ContentPlaceHolder control in a master page. When the URL of the content page is called, all text, markup, and server controls that are contained within the Content control are rendered to the ContentPlaceHolder on the master page, and the address bar of the browser will show the name of the content page.
For more information about master pages and content pages, see ASP.NET Master Pages Overview.
| Topic | Location |
|---|---|
| Walkthrough: Creating and Using ASP.NET Master Pages in Visual Web Developer | Building ASP .NET Web Applications in Visual Studio |
| How to: Create Content Pages for an ASP.NET Master Page (Visual Studio) | Building ASP .NET Web Applications in Visual Studio |
The following code example shows how to use the Content control to define the content for a master page. The first Web page is a master page and defines a content region using a ContentPlaceHolder control.
The following code example demonstrates how to use a content page for the preceding master page. The text, markup, and any server controls that are defined within the Content control template are rendered to the ContentPlaceHolder on the master page.
- AspNetHostingPermission for running the Content control in a hosted environment. Associated enumeration: Minimal
- AspNetHostingPermission for running the Content control in a hosted environment. Associated enumeration: Minimal