我可以在Asp.Net中更改子页面加载上的母版页背景图像 [英] Can I Change Master Page Background Image On Child Page Load In Asp.Net

查看:204
本文介绍了我可以在Asp.Net中更改子页面加载上的母版页背景图像的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个带有背景图片的母版页。现在我想从菜单中加载来改变任何孩子的背景图像。所以它看起来像专业网站。



请求帮助我。你可以通过mukesh.angel2007@gmail.com与我联系

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

推荐答案

检查这个问题的答案 http://stackoverflow.com/questions/2209/how-can -i-change-a-masterpage-from-the-code-behind-a-conten [ ^ ]
Check the answer of this question http://stackoverflow.com/questions/2209/how-can-i-change-the-background-of-a-masterpage-from-the-code-behind-of-a-conten[^]


您可以尝试在后面的主页面代码中创建方法,例如changeBG(),然后在内容页面中调用该方法,如:

You can try to create method in the Master page code behind say changeBG() and then call that method in the content page like:
this.master.changeBG();





In后面的母版页代码的changeBG()写了背景更改代码,如:



In the changeBG() of master page code behind write the background changing code like:

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 :)


目前我正在设置来自css文件的背景图片。 [文件名 - Style.css]请帮帮我。下面是背景图像和母版页代码的CSS代码。



.masterpagebackcolor1 / *#2c2b27 * /

{

身高:75%;

background-image:url('Untitled.gif');

background-color:#002C68;



}









主页面代码如下。



]]>

]]> - %>



- %>]]>
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.

]]>
]]>--%>

--%>]]>


这篇关于我可以在Asp.Net中更改子页面加载上的母版页背景图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆