Created
July 27, 2010 01:17
-
-
Save tathamoddie/491560 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static void RegisterStyleSheets(this Page page, IEnumerable<string> appRelativePaths) | |
{ | |
if (page == null) throw new ArgumentNullException("page"); | |
if (page.Header == null) throw new ArgumentException("Page header is unavailable.", "page"); | |
var links = appRelativePaths | |
.Select(page.ResolveClientUrl) | |
.Select(p => | |
{ | |
var link = new HtmlLink { Href = p }; | |
link.Attributes.Add("rel", "stylesheet"); | |
link.Attributes.Add("type", "text/stylesheet"); | |
return link; | |
}); | |
foreach(var link in links) | |
page.Header.Controls.Add(links); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment