另外,相对于这种方法,还有一种简单的Hack,首先在MasterPage中添加<link>标签,但是herf属性为空
<
head
runat
="server"
>
< link id ="cssStyleSheet1" rel ="stylesheet" type ="text/css" runat ="server" />
< link id ="cssStyleSheet2" rel ="stylesheet" type ="text/css" runat ="server" />
< link id ="cssStyleSheet3" rel ="stylesheet" type ="text/css" runat ="server" />
</ head >
数量只能寒一个了……如果不知道用多少,还是多放几个好了。然后在应用了MasterPage的页面里动态修改<link>标签的herf属性
< link id ="cssStyleSheet1" rel ="stylesheet" type ="text/css" runat ="server" />
< link id ="cssStyleSheet2" rel ="stylesheet" type ="text/css" runat ="server" />
< link id ="cssStyleSheet3" rel ="stylesheet" type ="text/css" runat ="server" />
</ head >
protected
void
Page_Init(
object
sender, EventArgs e) {
if ( ! IsPostBack) {
HtmlLink csslink = (HtmlLink)Master.FindControl( " cssStyleSheet1 " );
csslink.Attributes.Add( " href " , " Cart.css " );
}
}
目前我发现的办法就只有这两种了,如果各位还有什么好的办法,恳请告诉小弟,目前正在弄一个涉及这个问题的应用
if ( ! IsPostBack) {
HtmlLink csslink = (HtmlLink)Master.FindControl( " cssStyleSheet1 " );
csslink.Attributes.Add( " href " , " Cart.css " );
}
}
PS.园子是不是有个bug?突然发现,到首页了……似乎发到别的分类的,再编辑默认分类就变首页了……-_-bb