Click here to Skip to main content
15,893,161 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have a master page with background image. Now I want to change background image on any child from load from menu. So It look like professional site.

Pleaes help me on this. you can contact me at mukesh.angel2007@gmail.com
Posted
Comments
Vi(ky 8-May-14 3:15am    
just change the image url in css on child page for masterpage

 
Share this answer
 
Comments
Sanket Saxena 8-May-14 3:29am    
This should work. Nice :) +5
You can try to create method in the Master page code behind say changeBG() and then call that method in the content page like:
C#
this.master.changeBG();


In the changeBG() of master page code behind write the background changing code like:
C#
public void changeBG()
{
  bodyTag.Atributes.Add("background-image:", "url('gifs/page-body-background.gif'");
  //here bodyTag is the id of the body of the master page with runat="server"
}


Hope it helps :)
 
Share this answer
 
v2
Currently i am setting background-image from css file. [File Name - Style.css] Please help me o this. below is css code for background image and master page code.

.masterpagebackcolor1/*#2c2b27*/
{
height:75%;
background-image:url('Untitled.gif');
background-color :#002C68;

}




master page code is below.

]]>
]]>--%>

--%>]]>
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900