solve:using themed css files requires a header control on the page.(e.g)

using themed css files requires a header control on the page(e.g head runat=”server”/).

Solution is below:


you need a head tag with runat="server" in the page (or master page) as below.
<head runat="server">
<title></title>
</head>

It seems that you want to change the CSS file dynamically, if so, please refer this code.


HtmlHead head = (HtmlHead)Page.Header;
HtmlLink link = new HtmlLink();
link.Attributes.Add("href", Page.ResolveClientUrl("~/App_Themes/Default/website.css"));
link.Attributes.Add("type", "text/css");
link.Attributes.Add("rel", "stylesheet");
head.Controls.Add(link);

I feel none of the answers made above can resolve the actual issue faced by user
if the page is not meant to render html. In this case, the solution is – just paste following.


EnableTheming = "False" StylesheetTheme="" Theme=""

About the Author

avatar