Create a server control that contains the text, tags, and other server controls of the contentplaceholder control displayed on the master page.
<ASP: Content
Contentplaceholderid= "String"
Enableviewstate= "True | false"
ID= "String"
Runat= "Server">
Visible = "True | false"
<! -- Child controls -->
</ASP: Content>
The content control is the container of the content and control of the Content Page. The content control can only be used with the master page that defines the corresponding contentplaceholder control. The content control is not an independent control.
The followingCodeThe example shows how to use the content control to define the content of the master page. The first webpage is the master page, which uses a contentplaceholder control to define the content area.
<% @ master language =" C # "%>
doctype HTML Public "-// W3C // dtd xhtml 1.1 // en " " http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd " >
HTML xmlns =" http://www.w3.org/1999/xhtml " >
head runat =" server " >
title > masterpage example title >
head >
body >
form id =" form1 " runat =" server " >
Div >
Asp: contentplaceholder id =" contentplaceholder1 " runat =" server " />
Div >
form >
body >
</Html>
The following code example demonstrates how to use the content page of the master page used in the previous code example. The text, tag, and any server control defined in the Content Control template are displayed to the contentplaceholder on the master page.
<% @ Page Language = "C #" masterpagefile = "~ /Masterpagesample_1cs.master "Title =" content page "%>
<ASP: Content
Runat= "Server"
Contentplaceholderid= "Contentplaceholder1" >Hello, Master pages!</ASP: Content>