Nucleus .Net Core CMS

HtmlHelpers.AddScriptHtmlHelper Class

Namespace: Nucleus.ViewFeatures.HtmlHelpers
Assembly: Nucleus.ViewFeatures.dll
Html helper used to add scripts.
AddScript (IHtmlHelper htmlHelper, WellKnownScripts script)
Add a well-known script.
AddScript (IHtmlHelper htmlHelper, String scriptPath)
Register the specified script to be added to the Layout or module's scripts. Use ~! for the currently executing view path, or ~# for the currently executing extension.
Parameters
Name Type
htmlHelper Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper
scriptPath String
Examples
@Html.AddScript("~/Extensions/MyModule/MyModule.js")
Remarks
Extensions (modules) can use this Html Helper to add scripts to the HEAD block. The scriptPath can contain the tilde (~) character to specify an app-relative path, which should include the extensions folder and your extension folder name, or the scriptPath can contain the ~! for the currently executing view path, or ~# for the currently executing extension.
AddScript (IHtmlHelper htmlHelper, String scriptPath, Boolean isAsync)
Register the specified script to be added to the Layout or module's scripts. Use ~! for the currently executing view path, or ~# for the currently executing extension.
Parameters
Name Type
htmlHelper Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper
scriptPath String
isAsync Boolean
Examples
@Html.AddScript("~/Extensions/MyModule/MyModule.js")
Remarks
Extensions (modules) can use this Html Helper to add scripts to the HEAD block. The scriptPath can contain the tilde (~) character to specify an app-relative path, which should include the extensions folder and your extension folder name, or the scriptPath can contain the ~! for the currently executing view path, or ~# for the currently executing extension.
AddScript (IHtmlHelper htmlHelper, String scriptPath, Boolean isAsync, Int32 order)
Register the specified script to be added to the Layout or module's scripts. Use ~! for the currently executing view path, or ~# for the currently executing extension.
Parameters
Name Type
htmlHelper Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper
scriptPath String
isAsync Boolean
order Int32
Examples
@Html.AddScript("~/Extensions/MyModule/MyModule.js")
Remarks
Extensions (modules) can use this Html Helper to add scripts to the HEAD block. The scriptPath can contain the tilde (~) character to specify an app-relative path, which should include the extensions folder and your extension folder name, or the scriptPath can contain the ~! for the currently executing view path, or ~# for the currently executing extension.
AddScript (IHtmlHelper htmlHelper, String scriptPath, Boolean isAsync, Boolean isDynamic)
Register the specified script to be added to the Layout or module's scripts. Use ~! for the currently executing view path, or ~# for the currently executing extension.
Parameters
Name Type
htmlHelper Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper
scriptPath String
isAsync Boolean
isDynamic Boolean
Examples
@Html.AddScript("~/Extensions/MyModule/MyModule.js")
Remarks
Extensions (modules) can use this Html Helper to add scripts to the HEAD block. The scriptPath can contain the tilde (~) character to specify an app-relative path, which should include the extensions folder and your extension folder name, or the scriptPath can contain the ~! for the currently executing view path, or ~# for the currently executing extension.
AddScript (HttpContext context, String scriptPath, Boolean isAsync, Int32 order)
Register the specified script to be added to the Layout or module's scripts.
Parameters
Name Type
context Microsoft.AspNetCore.Http.HttpContext
scriptPath String
isAsync Boolean
order Int32
Remarks
This overload is intended for use by extensions which need to add a script from code other than a view. This overload does not support the tilde (~) character to specify an app-relative path. This overload does not append a version querystring element.
AddScript (HttpContext context, String scriptPath, Boolean isAsync, Boolean isDynamic, Int32 order, String version)
Register the specified script to be added to the Layout or module's scripts.
Parameters
Name Type
context Microsoft.AspNetCore.Http.HttpContext
scriptPath String
isAsync Boolean
isDynamic Boolean
order Int32
version String
AddWellKnownScript (IHtmlHelper htmlHelper, String script)
Register the specified script with defaults for well-known scripts, and without the async attribute.
Parameters
Name Type
htmlHelper Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper
script String
AddWellKnownScript (IHtmlHelper htmlHelper, String script, Boolean isAsync)
Register the specified script with defaults for well-known scripts, and with the async attribute as specified by isAsync.
Parameters
Name Type
htmlHelper Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper
script String
isAsync Boolean
GetCallerVersion (IHtmlHelper htmlHelper)
Return the version of the assembly which contains the calling controller action.
Parameters
Name Type
htmlHelper Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper
GetCoreVersion ()
Return the version of one of the Nucleus core assemblies.
Remarks
Well-known scripts are hosted by Nucleus.Web, so their version should come from one of the Nucleus core assemblies.
RenderScripts (IHtmlHelper htmlHelper)
Adds the scripts submitted by AddScript to the layout. This method is intended for use by the Nucleus Core layout.
Parameters
Name Type
htmlHelper Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper