Search code examples
htmlasp.netviewcontentplaceholder

What does ContentPlaceHolderID mean?


In a LogOn view, I have the following code:

<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">

What does this fragment mean and where is "MainContent" defined?

EDIT

Thanks for your replies. I now understand how it works, but where is "MainContent" defined? Is it defined in the master page?


Solution

  • The ContentPlaceHolderID describes the ContentPlaceHolder in the master page where the content will be placed.

    Here is the MSDN Documentation

    http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.content.contentplaceholderid(v=vs.110).aspx

    Say you have multiple content placeholders in your master page. You can tell each of your content controls on your page where to place the content. These Content controls do not need to be in the order they appear in your master page.

    Hope this helps.