November Happy Hour will be moved to Thursday December 5th.

Class MenuHelper

Methods used to render menus in various locations.

Inheritance
System.Object
MenuHelper
Inherited Members
System.Object.ToString()
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
Namespace: EPiServer.Shell.Navigation
Assembly: EPiServer.Shell.dll
Version: 9.12.2
Syntax
public static class MenuHelper

Methods

CalculatePathDepth(String)

Calculates depth of the menu path.

Declaration
public static int CalculatePathDepth(this string path)
Parameters
Type Name Description
System.String path

The path to calculate on

Returns
Type Description
System.Int32

The depth of the patch

CreateGlobalMenu(String, String)

Renders a complete GlobalMenu with containing html elements

Declaration
public static string CreateGlobalMenu(string path, string selectionPath)
Parameters
Type Name Description
System.String path

The menu path.

System.String selectionPath

The menu path to select, If null the selection will be autoresolved

Returns
Type Description
System.String

A chunk of html

CreateLocalMenu(String, String)

Renders a complete LocalMenu with containing html elements

Declaration
public static string CreateLocalMenu(string path, string selectionPath)
Parameters
Type Name Description
System.String path

The menu path.

System.String selectionPath

The menu path to select, If null the selection will be autoresolved

Returns
Type Description
System.String

A chunk of html

EnsureValidMenuPath(String)

Ensures the the path is valid. Removes trailing / and appends missing / at the start

Declaration
public static string EnsureValidMenuPath(this string path)
Parameters
Type Name Description
System.String path
Returns
Type Description
System.String

GlobalMenu(HtmlHelper)

Renders a complete GlobalMenu with containing html elements

Declaration
public static string GlobalMenu(this HtmlHelper htmlHelper)
Parameters
Type Name Description
System.Web.Mvc.HtmlHelper htmlHelper

The object this method is attached to.

Returns
Type Description
System.String

A chunk of html

GlobalMenu(HtmlHelper, String)

Renders a complete GlobalMenu with containing html elements

Declaration
public static string GlobalMenu(this HtmlHelper htmlHelper, string path)
Parameters
Type Name Description
System.Web.Mvc.HtmlHelper htmlHelper

The object this method is attached to.

System.String path

The menu path.

Returns
Type Description
System.String

A chunk of html

GlobalMenu(HtmlHelper, String, String)

Renders a complete GlobalMenu with containing html elements

Declaration
public static string GlobalMenu(this HtmlHelper htmlHelper, string path, string selectionPath)
Parameters
Type Name Description
System.Web.Mvc.HtmlHelper htmlHelper

The object this method is attached to.

System.String path

The menu path.

System.String selectionPath

The menu path to select, If null the selection will be autoresolved

Returns
Type Description
System.String

A chunk of html

LocalMenu(HtmlHelper, String)

Renders a complete LocalMenu with containing html elements

Declaration
public static string LocalMenu(this HtmlHelper htmlHelper, string path)
Parameters
Type Name Description
System.Web.Mvc.HtmlHelper htmlHelper

The object this method is attached to.

System.String path

The menu path.

Returns
Type Description
System.String

A chunk of html

LocalMenu(HtmlHelper, String, String)

Renders a complete LocalMenu with containing html elements

Declaration
public static string LocalMenu(this HtmlHelper htmlHelper, string path, string selectionPath)
Parameters
Type Name Description
System.Web.Mvc.HtmlHelper htmlHelper

The object this method is attached to.

System.String path

The menu path.

System.String selectionPath

The menu path to select, If null the selection will be autoresolved

Returns
Type Description
System.String

A chunk of html

ShellMenu(String, String)

Renders a complete menu with containing html elements

Declaration
public static string ShellMenu(string path, string selectionPath)
Parameters
Type Name Description
System.String path

The menu path.

System.String selectionPath

The menu path to select, If null the selection will be autoresolved

Returns
Type Description
System.String

A chunk of html