Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public static partial class HtmlExtentions {
- public static MvcHtmlString StyleSheetLink(this HtmlHelper html,string href,object additionalAttributes = null) {
- TagBuilder tag = new TagBuilder("link");
- tag.MergeAttribute("href",href);
- tag.MergeAttribute("rel","stylesheet");
- tag.MergeAttribute("type","text/css");
- if(additionalAttributes != null) {
- var htmlatts = RouteValueHelper.AnonymousObjectToHtmlAttributes(additionalAttributes);
- if(htmlatts != null)
- tag.MergeAttributes(htmlatts,true);
- }
- string tagHtml = tag.ToString(TagRenderMode.SelfClosing);
- return new MvcHtmlString(tagHtml);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment