-
-
Notifications
You must be signed in to change notification settings - Fork 65
Html Attributes
In many cases you may want to add custom html attributes to the rendered script
or link
tags that are output. There are numerous overloads for registering your dependencies and many of them contain an HtmlAttributes
property that you can set.
It's important to note that if your Require statements have different html attributes applied then CDF will output them as different html script/link tags because the attributes will be different. Similarly if the attributes are the same then CDF will bundle them together. CDF is smart enough to bundle the dependencies together that have matching attributes and will maintain the same output order in html.
Html.RequiresCss("~/css/styles.css", new Dictionary<string, string>() { { "media", "print,projection" } });
Webforms controls can be manipulated directly in the codebehind file by modifying the HtmlAttributes property, or can be done in markup with the HtmlAttributesAsString property with a comma separated list of items such as: key1:'value1',key2:'value2'
<CD:CssInclude runat="server" FilePath="~/css/styles.css" HtmlAttributesAsString="media:'print,projection'" />