Friday, November 7, 2008

ASP.net Beginner - ContentPlaceHolder

This post is for beginner of ASP.net.

ContentPlaceHolder is one of the great feature ASP.net.

When you use a masterpage to make layout of your site. You have to put several ContentPlaceHolder in it so that other pages can put their content in the ContentPlaceHolder. Kindly read the following examples and reference.


1. Place the ContentPlaceHolder in one place (can have default content in ContentPlaceHolder), e.g.

<asp:contentplaceholder id="FlowerText" runat="server"/>

2. And then place the content in other place.

<asp:content id="Content1" contentplaceholderid="FlowerText" runat="server"> Actual content here </asp:content>

References:
http://quickstarts.asp.net/QuickStartv20/aspnet/doc/masterpages/default.aspx

http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.contentplaceholder.aspx

http://msdn.microsoft.com/en-us/library/fft2ye18(VS.80).aspx

Using Inheritance

References:

http://www.codeproject.com/KB/aspnet/page_templates.aspx

Microsoft learning of ASP.net

http://www.microsoft.com/learning/en/us/syllabi/2311Afinal.mspx

No comments: