开发者

change the master page body color from different pages when they load in vb.net

I have like 10 aspx pages (junior_class_stud开发者_高级运维ents1.aspx-...10.aspx). They all have the same master page in the back (class_students.master). Everytime i load a page i want the master page background-color to change, to the one that i can specify per page. so ...students1.aspx then .master ...students2.aspx then .master ...students3.aspx then .master

how can this be achieved?


Keep in mind that content holders can go anywhere in the page. It's possible to do something like this:

<div style="background-color:<asp:ContentPlaceHolder id="divColor" runat="server" />"></div>

And then in your page have this:

<asp:Content ID="divColorContent" ContentPlaceHolderID="divColor" Runat="Server">green</asp:Content>


CSS classes.

You could place a div that fills the body inside on body and contentplaceholder.

Master Page

<body>
<asp:ContentPlaceHolder id="cph" runat="server" />
</body>

That div could have a uniuqe ID per page.

Cntent page

<asp:Content id="cnt" ContentPlaceHolderID="cph">
    <div id="Page1" class="container">
      <!--Page Content-->
    </div>
</asp:Content>

Then CSS could be something like:

div.container
{
    width: 100%;
    height: 100%;
}
div#Page1
{
    background-color: green;
}
div#Page2
{
    background-color: blue;
}
...
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜