Class ScriptExtensions
Client script related html helper extensions
Inheritance
Inherited Members
Namespace: EPiServer.Shell.Web.Mvc.Html
Assembly: EPiServer.Shell.dll
Version: 8.11.0Syntax
public static class ScriptExtensions
Methods
SerializeAsJson(HtmlHelper, Object)
Serializes an object as json.
Declaration
[Obsolete("Use SerializeObject with contentType application/json instead")]
public static string SerializeAsJson(this HtmlHelper html, object value)
Parameters
Type | Name | Description |
---|---|---|
System.Web.Mvc.HtmlHelper | html | The html helper to hook the helper on. |
System.Object | value | The object that should be serialized. |
Returns
Type | Description |
---|---|
System.String | A string containing a serialized json object. |
SerializeObject(HtmlHelper, Object, String)
Serializes the object using the registered serializer for the target content type.
Declaration
public static string SerializeObject(this HtmlHelper html, object value, string contentType)
Parameters
Type | Name | Description |
---|---|---|
System.Web.Mvc.HtmlHelper | html | The html helper to hook the helper on. |
System.Object | value | The object that should be serialized. |
System.String | contentType | The type of serializer to use. |
Returns
Type | Description |
---|---|
System.String | A string containing the serialized objct |
Exceptions
Type | Condition |
---|---|
System.ArgumentException | when no serializer is registered for |
ShellAsyncInitializationScript(HtmlHelper)
Creates a script element for client side initialization of the shell.
Declaration
public static IHtmlString ShellAsyncInitializationScript(this HtmlHelper html)
Parameters
Type | Name | Description |
---|---|---|
System.Web.Mvc.HtmlHelper | html |
Returns
Type | Description |
---|---|
System.Web.IHtmlString |
ShellInitializationScript(HtmlHelper)
Creates a script element for client side initialization of the shell.
Declaration
public static IHtmlString ShellInitializationScript(this HtmlHelper html)
Parameters
Type | Name | Description |
---|---|---|
System.Web.Mvc.HtmlHelper | html |
Returns
Type | Description |
---|---|
System.Web.IHtmlString |
ShellScriptBase(HtmlHelper)
Returns a script tags used throughout the EPiServer Shell.
Declaration
public static IHtmlString ShellScriptBase(this HtmlHelper html)
Parameters
Type | Name | Description |
---|---|---|
System.Web.Mvc.HtmlHelper | html | The html helper to hook the helper on. |
Returns
Type | Description |
---|---|
System.Web.IHtmlString | A script html tag. |
ShellScriptResource(HtmlHelper, String)
Returns a script tag for a resource relative to the shell root.
Declaration
public static IHtmlString ShellScriptResource(this HtmlHelper html, string shellRelativeSourcePath)
Parameters
Type | Name | Description |
---|---|---|
System.Web.Mvc.HtmlHelper | html | The html helper to hook the helper on. |
System.String | shellRelativeSourcePath | The path to the script resource. |
Returns
Type | Description |
---|---|
System.Web.IHtmlString | A script html tag. |