Change the color of the main page of the main page from different pages when loading in vb.net

I have 10 aspx pages (junior_class_students1.aspx -... 10.aspx). They all have the same main page at the back (class_students.master). Every time I load a page, I want the main background color of the main page to change, and the one I can specify on the page. therefore ... students1.aspx then.master ... students2.aspx then.master ... students3.aspx then.master

how can this be achieved?

+4
source share
2 answers

Keep in mind that content owners can navigate anywhere on the page. It is possible to do something like this:

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

And then on your page there is the following:

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

CSS classes.

You can put a div that fills the body inside the body and content owner.

Master page

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

This div may have the uniuqe identifier on the page.

Cntent Page

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

Then CSS might look something like this:

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

Source: https://habr.com/ru/post/1304589/


All Articles