如何在母版页中应用背景图像 [英] how to apply background image in master page
本文介绍了如何在母版页中应用背景图像的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我试图在我的asp.net项目的母版页中应用背景图片.它在设计窗口和default.aspx中可见,我将母版页文件属性设置为我的母版页路径.但是当我运行项目时,它给我的错误是:
"
i m trying to apply background image in master page of my asp.net project. it is visible in design window and in my default.aspx i m setting master page file property to path of my master page. but when i run the project it gives me error as:
"
Content controls have to be top-level controls in a content page or a nested master page that references a master page.
"
我的母版页代码是:
"
my master page code is:
</head>
<body background="BackGround.gif">
<form id="form1" runat="server">
<div>
</div>
<asp:ContentPlaceHolder id="ContentPlaceHolder1" runat="server">
<p style="height: 319px; width: 718px">
hello welcome to asp.net
</p>
</asp:ContentPlaceHolder>
</form>
</body>
</html>
请告诉我问题出在哪里.
plz tell me what is the problem.
推荐答案
阿米蒂杜卡(Amitindurkar)
masterpage.master
来自codebehind
在母版页代码背后
mpBodyTag.Attributes.Add("style","background:...");
在母版页代码后面
公共HtmlGenericControl BodyTag
{
get {return mpBodyTag;}
set {mpBodyTag = value;}
}
在子页面中
Master.BodyTag.Attributes.Add("style","background:...");
再见
hi Amitindurkar
masterpage.master
from codebehind
in master page codebehind
mpBodyTag.Attributes.Add("style","background: ... ");
in masterpage codebehind
public HtmlGenericControl BodyTag
{
get{return mpBodyTag;}
set{mpBodyTag= value;}
}
in child page
Master.BodyTag.Attributes.Add("style","background: ... ");
bye
这篇关于如何在母版页中应用背景图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文