/// <summary>
 /// Gets SiteMap path for the current request
 /// </summary>
 /// <param name="helper">MvcSiteMapHtmlHelper instance</param>
 /// <param name="templateName">Name of the template.</param>
 /// <returns>SiteMap path for the current request</returns>
 public static MvcHtmlString SiteMapPath(this MvcSiteMapHtmlHelper helper, string templateName)
 {
     var model = BuildModel(helper, helper.Provider.CurrentNode);
     return helper
         .CreateHtmlHelperForModel(model)
         .DisplayFor(m => model, templateName);
 }
예제 #2
0
 /// <summary>
 /// Gets the CanonicalUrl 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 CanonicalUrl of the CurrentNode or the RootNode (if CurrentNode is null)</returns>
 public static MvcHtmlString CanonicalTag(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);
 }
예제 #3
0
 /// <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, SourceMetadataDictionary sourceMetadata)
 {
     var model = BuildModel(helper, GetSourceMetadata(sourceMetadata), startingNode, rootInChildLevel);
     return helper
         .CreateHtmlHelperForModel(model)
         .DisplayFor(m => model, templateName);
 }
예제 #4
0
 /// <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>
 /// <param name="sourceMetadata">User-defined meta data.</param>
 /// <returns>Html markup</returns>
 public static MvcHtmlString Menu(this MvcSiteMapHtmlHelper helper, string templateName, ISiteMapNode startingNode, bool startingNodeInChildLevel, bool showStartingNode, int maxDepth, bool drillDownToCurrent, SourceMetadataDictionary sourceMetadata)
 {
     var model = BuildModel(helper, GetSourceMetadata(sourceMetadata), startingNode, startingNodeInChildLevel, showStartingNode, maxDepth, drillDownToCurrent);
     return helper
         .CreateHtmlHelperForModel(model)
         .DisplayFor(m => model, templateName);
 }
예제 #5
0
 /// <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 Pills(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, "Sitemap/Pills");
 }
예제 #6
0
 /// <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);
 }
예제 #7
0
 /// <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, helper.Provider.CurrentNode ?? helper.Provider.RootNode);
     return helper.CreateHtmlHelperForModel(model).DisplayFor(m => model, templateName);
     //return MvcHtmlString.Create(model.CurrentNode.Title);
 }