我想在页面加载时以编程方式替换http://www.somewebsite.com
。
有可能吗?
<head runat="server">
<title></title>
<link href="http://www.somewebsite.com/App_Themes/Blue/StyleSheet.css" rel="stylesheet" type="text/css" />
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<!--[if IE]>
<link rel="stylesheet" type="text/css" href="www.somewebsite.com/inc/styles_ie.css" />
<![endif]-->
<link href="http://www.somewebsite.com/App_Themes/RedBlack/StyleSheet.css" type="text/css" rel="stylesheet" />
</head>
答案 0 :(得分:0)
在这里,我找到了一个非常好的例子:http://www.codeproject.com/Tips/523983/Adding-Styles-Dynamically-to-ASP-NET-Page-Header
Literal cssFile = new Literal()
{
Text = @"<link href=""" + Page.ResolveUrl(styleFilePath) +
@""" type=""text/css"" rel=""stylesheet""/>"
};
Page.Header.Controls.Add(cssFile);