aspxtreme

Content Control Syntax

ASP.NET Syntax   ASP.NET Syntax for Web Controls


Serves to contain a section of content that is rendered to an associated ContentPlaceHolder control in a master page.

Declarative Syntax

For information on the individual members of this class, see Content in the class library.

Remarks

A Content control is essentially a container for the content of a Web Forms page. Like any Web Forms page, a Content control can contain a combination of HTML, ASP.NET server controls, and static text.

A Content control, though, is used only with a master page that defines an associated ContentPlaceHolder control, and cannot be used as a stand-alone page.

NOTE: While a single .aspx content file can have one or more <asp:content> controls, only one Content control can be associated for each <asp:contentplaceholder> control in the linked master page.

Syntax Example

This site is an actual example of using master pages. This page is actually made up of Content controls, which in turn make up the content of <asp:contentplaceholder> controls defined in the master page file. To see how this page and its master page is done, click here.

Notice that there is no reference to the master page file on this page. This is because references to the master page files used on this site are stored in web.config files that cover different subsections of this site.

<configuration>
   <system.web>
      <pages masterPageFile = "~/aspnet/aspnet.master" />
   </system.web>
</configuration>

This way, any file ( that includes <asp:content> controls ) within the application boundary covered by the web.config file, automatically use the referenced master page file.

See Also

Content Class



Books and more ...


Suggested Reading

Need a break ?



Previous page Back to top Next page

Check out related books at Amazon

© 2000-2008 Rey Nuñez All rights reserved.

If you have any question, comment or suggestion
about this site, please send us a note

You can help support aspxtreme