public static class PageExtensions
{
private const string styleInclude = "$styleInclude";
public static void RegisterClientStyleInclude(this Page page, Type type, string key, string url)
{
var styleLink = new System.Web.UI.HtmlControls.HtmlLink();
styleLink.Href = url;
styleLink.Attributes.Add("rel", "stylesheet");
styleLink.Attributes.Add("type", "text/css");
page.Header.Controls.Add(styleLink);
page.Items[styleInclude + type.ToString() + key] = true;
}
public static bool IsClientStyleIncludeRegistered(this Page page, Type type, string key)
{
return page.Items.Contains(styleInclude + type.ToString() + key);
}
}