/// <summary> /// Gets the title of SiteMap.CurrentNode /// </summary> /// <param name="helper">MvcSiteMapHtmlHelper instance</param> /// <param name="templateName">Name of the template.</param> /// <param name="sourceMetadata">User-defined meta data.</param> /// <returns>The title of the CurrentNode or the RootNode (if CurrentNode is null)</returns> public static MvcHtmlString SiteMapTitle(this MvcSiteMapHtmlHelper helper, string templateName, SourceMetadataDictionary sourceMetadata) { var model = BuildModel(GetSourceMetadata(sourceMetadata), helper.SiteMap.CurrentNode ?? helper.SiteMap.RootNode); return(helper .CreateHtmlHelperForModel(model) .DisplayFor(m => model, templateName)); }
/// <summary> /// Gets SiteMap path for the current request /// </summary> /// <param name="helper">MvcSiteMapHtmlHelper instance</param> /// <param name="templateName">Name of the template.</param> /// <param name="startingNodeKey">The key of the starting node (the last node in the site map path).</param> /// <param name="sourceMetadata">User-defined meta data.</param> /// <returns>SiteMap path for the current request</returns> public static MvcHtmlString SiteMapPath(this MvcSiteMapHtmlHelper helper, string templateName, ISiteMapNode startingNode, SourceMetadataDictionary sourceMetadata) { var model = BuildModel(helper, GetSourceMetadata(sourceMetadata), startingNode); return(helper .CreateHtmlHelperForModel(model) .DisplayFor(m => model, templateName)); }
/// <summary> /// Build a sitemap tree, based on the MvcSiteMap /// </summary> /// <param name="helper">The helper.</param> /// <param name="templateName">Name of the template.</param> /// <param name="startingNode">The starting node.</param> /// <param name="rootInChildLevel">Renders startingNode in child level if set to <c>true</c>.</param> /// <param name="sourceMetadata">User-defined meta data.</param> /// <returns>Html markup</returns> public static MvcHtmlString SiteMap(this MvcSiteMapHtmlHelper helper, string templateName, ISiteMapNode startingNode, bool rootInChildLevel, bool visibilityAffectsDescendants, SourceMetadataDictionary sourceMetadata) { var model = BuildModel(helper, GetSourceMetadata(sourceMetadata), startingNode, rootInChildLevel, visibilityAffectsDescendants); return(helper .CreateHtmlHelperForModel(model) .DisplayFor(m => model, templateName)); }
/// <summary> /// Build a sitemap tree, based on the MvcSiteMap /// </summary> /// <param name="helper">The helper.</param> /// <param name="templateName">Name of the template.</param> /// <param name="startingNode">The starting node.</param> /// <param name="rootInChildLevel">Renders startingNode in child level if set to <c>true</c>.</param> /// <returns>Html markup</returns> public static MvcHtmlString SiteMap(this MvcSiteMapHtmlHelper helper, string templateName, SiteMapNode startingNode, bool rootInChildLevel) { var model = BuildModel(helper, startingNode, rootInChildLevel); return(helper .CreateHtmlHelperForModel(model) .DisplayFor(m => model, templateName)); }
/// <summary> /// Gets the title of SiteMap.CurrentNode /// </summary> /// <param name="helper">MvcSiteMapHtmlHelper instance</param> /// <param name="templateName">Name of the template.</param> /// <returns> /// The title of the CurrentNode or the RootNode (if CurrentNode is null) /// </returns> public static MvcHtmlString SiteMapTitle(this MvcSiteMapHtmlHelper helper, string templateName) { var model = BuildModel(helper.Provider.CurrentNode ?? helper.Provider.RootNode); return(helper .CreateHtmlHelperForModel(model) .DisplayFor(m => model, templateName)); }
/// <summary> /// Build a menu, based on the MvcSiteMap /// </summary> /// <param name="helper">The helper.</param> /// <param name="templateName">Name of the template.</param> /// <param name="startingNode">The starting node.</param> /// <param name="startingNodeInChildLevel">Show starting node in child level if set to <c>true</c>.</param> /// <param name="showStartingNode">Show starting node if set to <c>true</c>.</param> /// <param name="maxDepth">The max depth.</param> /// <param name="drillDownToCurrent">Should the model exceed the maxDepth to reach the current node</param> /// <returns>Html markup</returns> public static MvcHtmlString Menu(this MvcSiteMapHtmlHelper helper, string templateName, SiteMapNode startingNode, bool startingNodeInChildLevel, bool showStartingNode, int maxDepth, bool drillDownToCurrent) { var model = BuildModel(helper, startingNode, startingNodeInChildLevel, showStartingNode, maxDepth, drillDownToCurrent); return(helper .CreateHtmlHelperForModel(model) .DisplayFor(m => model, templateName)); }