动态设置MasterPage的< body>标签样式 [英] Dynamically setting a MasterPage's <body> tag style
问题描述
只需修改MasterPage就可以轻松让子页面操作MasterPage的标题
:
< header runat =" server">
....
....
< / header>
然后,在代码中,我们可以执行诸如Header.Title =" Welcome" ;;
但是,是否可以对MasterPage的< body标签执行相同操作?
具体来说,我正在寻找一种获取子页面的方法在某些页面上创建
后面的HTML而不是其他页面:
< body style =" BACKGROUND-POSITION:center bottom;背景 - 附件:
固定; BACKGROUND-IMAGE:url(images / skylinelogo.gif);背景 - 重复:
no-repeat">
我真的不想为此而拥有第二个MasterPage,因为这个/>
背景图片是对本网站基本布局的唯一更改 - 只有
子页面内容的变化,显然......但是,我这样做了
感谢这将是一个非常简单快速的解决方法... :-)
感谢所有的帮助。
马克
Hi,
It''s easy enough for a child page to manipulate its MasterPage''s header
simply by modifying the MasterPage thus:
<header runat="server">
....
....
</header>
Then, in code, we can do stuff like Header.Title = "Welcome";
However, is it possible to do the same for the MasterPage''s <body tag?
Specifically, I''m looking for a way to get a child page to create the
following HTML on some pages but not on others:
<body style="BACKGROUND-POSITION: center bottom; BACKGROUND-ATTACHMENT:
fixed; BACKGROUND-IMAGE: url(images/skylinelogo.gif); BACKGROUND-REPEAT:
no-repeat">
I don''t really want to have a second MasterPage just for this, because this
background image is the only change to the basic layout of this site - only
the contents of the child pages changes, obviously... However, I do
appreciate that that would be a very simple and quick workaround... :-)
Any assistance gratefully received.
Mark
推荐答案
Mark,
你最好不要在样式表中设置正文样式css
而不是标签上的内联,然后只是安排将动态加载到页面中的正确
stylexx.css?
Peter
< br $> b $ b -
联合创始人,Eggheadcafe.com开发者门户网站:
http://www.eggheadcafe.com
UnBlog:
http://petesbloggerama.blogspot.com
" ; Mark Rae写道:
Mark,
Wouldn''t you be better off setting the body Style css in a Stylesheet
instead of inline on the tag, and then just arranging to load the correct
stylexx.css dynamically into the page?
Peter
--
Co-founder, Eggheadcafe.com developer portal:
http://www.eggheadcafe.com
UnBlog:
http://petesbloggerama.blogspot.com
"Mark Rae" wrote:
子页面操作MasterPage的标题很容易
只需修改MasterPage即可:
< header runat =" server">
....
....
< / header>
然后,在代码中,我们可以做像Header.Title这样的事情=欢迎;
但是,是否可以对MasterPage的< body标签执行相同操作?
具体来说,我正在寻找一种方法来让一个子页面在某些页面上创建
,而不是在其他页面上创建
:
< body style =" BACKGROUND-POSITION:center bottom;背景 - 附件:
固定; BACKGROUND-IMAGE:url(images / skylinelogo.gif);背景 - 重复:
no-repeat">
我真的不想为此而拥有第二个MasterPage,因为这个/>
背景图片是对本网站基本布局的唯一更改 - 只有
子页面内容的变化,显然......但是,我这样做了
感谢这将是一个非常简单快速的解决方法... :-)
感谢所有的帮助。
马克
Hi,
It''s easy enough for a child page to manipulate its MasterPage''s header
simply by modifying the MasterPage thus:
<header runat="server">
....
....
</header>
Then, in code, we can do stuff like Header.Title = "Welcome";
However, is it possible to do the same for the MasterPage''s <body tag?
Specifically, I''m looking for a way to get a child page to create the
following HTML on some pages but not on others:
<body style="BACKGROUND-POSITION: center bottom; BACKGROUND-ATTACHMENT:
fixed; BACKGROUND-IMAGE: url(images/skylinelogo.gif); BACKGROUND-REPEAT:
no-repeat">
I don''t really want to have a second MasterPage just for this, because this
background image is the only change to the basic layout of this site - only
the contents of the child pages changes, obviously... However, I do
appreciate that that would be a very simple and quick workaround... :-)
Any assistance gratefully received.
Mark
" Peter Bromberg [C#MVP]" < pb ******* @ yahoo.nospammin.com写信息
news:61 ********************* ************* @ microsof t.com ...
彼得,
"Peter Bromberg [C# MVP]" <pb*******@yahoo.nospammin.comwrote in message
news:61**********************************@microsof t.com...
Peter,
你最好不要在样式表中设置身体样式css
而不是标签上的内联,然后只需安排加载正确的
stylexx。 css动态进入页面?
Wouldn''t you be better off setting the body Style css in a Stylesheet
instead of inline on the tag, and then just arranging to load the correct
stylexx.css dynamically into the page?
是的,我可以这样做。
那么,有没有简单的方法来操纵MasterPage的< ;
中的正文/标记是< head / tag ...?
Mark
Yes, I could do that.
So, is there no easy way of manipulating a MasterPage''s <body /tag in the
same way is its <head /tag...?
Mark
Mark Rae写道:
Mark Rae wrote:
" Peter Bromberg [C#MVP]" < pb ******* @ yahoo.nospammin.com写信息
news:61 ********************* ************* @ microsof t.com ...
彼得,
"Peter Bromberg [C# MVP]" <pb*******@yahoo.nospammin.comwrote in message
news:61**********************************@microsof t.com...
Peter,
>你最好不要在样式表中设置body样式css而不是在标签上内联,然后只是安排将动态加载到页面中的正确
stylexx.css?
>Wouldn''t you be better off setting the body Style css in a Stylesheet
instead of inline on the tag, and then just arranging to load the correct
stylexx.css dynamically into the page?
是的,我可以这样做。
那么,有没有简单的方法来操纵MasterPage的< ;
中的正文/标记是< head / tag ...?
Mark
Yes, I could do that.
So, is there no easy way of manipulating a MasterPage''s <body /tag in the
same way is its <head /tag...?
Mark
你不想错过这里的观点吗?如果您使用css文件设置样式
,则根本不需要对body标签进行任何操作。
Aren''t you missing the point here? If you set the style using a css file
you don''t have to do any manipulation of the body tag at all.
这篇关于动态设置MasterPage的< body>标签样式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!