/// <summary> /// Creates one breadcrumb link entry with the specified /// <paramref name="title" /> and link. /// </summary> /// <param name="title">The title of the breadcrumb link</param> /// <param name="stringUrl">The fully quallified URL</param> /// <param name="divider"> /// Specify the divider created after the link. Set to "null" or empty /// for no divider. /// </param> public MvcHtmlString BreadcrumbLink(string title, string stringUrl, string divider) { var listItem = new TagBuilderExt("li"); if (IsCurrentUrl(stringUrl)) { listItem.AddCssClass("active"); listItem.SetInnerText(title); } else { var link = new TagBuilderExt("a"); link.MergeAttribute("href", stringUrl); link.SetInnerText(title); listItem.AddChildTag(link); } if (!string.IsNullOrEmpty(divider)) { var dividerTag = new TagBuilderExt("span", divider); dividerTag.AddCssClass("divider"); listItem.AddChildTag(dividerTag); } return(listItem.ToMvcHtmlString()); }
/// <summary> /// Creates one menu link entry with the specified /// <paramref name="title" /> and link. /// </summary> /// <param name="title">The title of the menu link</param> /// <param name="url">The fully quallified URL</param> public MvcHtmlString MenuLink(string title, string url) { var listItem = new TagBuilderExt("li"); if (IsCurrentUrl(url)) { listItem.AddCssClass("active"); } var link = new TagBuilderExt("a"); link.MergeAttribute("href", url); link.SetInnerText(title); listItem.AddChildTag(link); return(listItem.ToMvcHtmlString()); }