[英]How can i print a page in asp.net without master page and to change color schemes of the page?
[英]How to change background color of master page ASP .Net
如何在ASP.NET客戶端和服務器端更改頁面背景顏色
我試過了
.color
{
PageBody.Attributes.Add("bgcolor", "yellow");
}
在css文件中編寫並用作aclass =“ color”
如果要在運行時更改背景色,則需要在runat="server"
定義母版頁正文
那是
<body id="MasterBody" runat="server">
</body>
如果要在“母版頁加載”中更改顏色,請在“母版頁加載事件”中添加以下代碼
MasterBody.Attributes.Add("style", "background-color: #2e6095");
另外,如果要更改指定母版頁文件中單個頁面的主體顏色,則首先需要從母版頁中找到主體控件,並在其中添加上述代碼,例如
System.Web.UI.HtmlControls.HtmlGenericControl MasterBody = (System.Web.UI.HtmlControls.HtmlGenericControl)Master.FindControl("MasterBody");
MasterBody.Attributes.Add("style", "background-color: #2e6095");
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.