I've a CSS file, say SomeStyle.css. Is it possible for me to apply this style sheet document to an aspx page from its code behind?
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
回答1:
You can add literal controls to your header control:
Page.Header.Controls.Add(
new System.Web.UI.LiteralControl("<link rel=\"stylesheet\" type=\"text/css\" href=\"" + ResolveUrl("~/Styles/SomeStyle.css") + "\" />"));