What is the ContentPlaceHolder in master page head? I mean how I can use it?
Thanks
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Jaganathan BantheswaranPosted Jun 29, 2011, 6:26 AM
If you need to include a style for a specific web form, you need to have a ContentPlaceHolder in head section of Master page.
For ex:
Master page:
<%@ Master Language="C#" %>
...
<head runat="server">
...
<asp:ContentPlaceHolder runat="server" id="headerPlaceHolder" />
head>
...
Content page:
<%@ Page Language="C#"
MasterPageFile="~/Master1.master"
Title="Foo" %>
<asp:Content ID="Content1"
ContentPlaceHolderID="headerPlaceHolder"
runat="Server">
<meta name="keywords" content="declassified information" />
<style type="text/css" media="all">
@import "wildstyle.css";
style>
<script type="text/javascript" src="foo.js">script>
asp:Content>
Suthish NairPosted Jul 1, 2011, 8:42 AM
contents (asp:Content) of an associated Content control.
On a master page we can have one or more ContentPlaceHolder controls.
For more articles check Our recommended articles section on right side.
raghu vPosted Jul 1, 2011, 6:25 AM
see master page is genarally used to make ur app to make maintainable easly
if u have set of pages in which u feel the outlook will be same just controls in some parts changes then to make the maintaince easy u go for master page concept in master page u create an out look which will be static for all the pages and content place holder is the one which tell u that page in heriting the master page control will use that area for changable datacontrol which are neeed for that perticular page
for ex:
if u have the master page say masterpage.master
here in masterpage.master u will have u entire static design lay out and empty content place holder
if i have in herited the masterpage.master to default.aspx then here in default .aspx i will get on content place holder where i just need to write the set of controls specific for that page but out look willl be copied from master page which in runtime will make u to get complete page
hope it will help u
Akkiraju IvaturiPosted Jul 1, 2011, 1:06 AM