Nucleus .Net Core CMS

HtmlHelpers.AddScriptHtmlHelper Class

Namespace: Nucleus.ViewFeatures.HtmlHelpers
Assembly: Nucleus.ViewFeatures.dll
Html helper used to add scripts.

Methods

AddScript (IHtmlHelper,WellKnownScripts) Method

AddScript (IHtmlHelper htmlHelper, WellKnownScripts script)
Add a well-known script.

AddScript (IHtmlHelper,String) Method

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,String,Boolean) Method

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,String,Boolean,Int32) Method

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,String,Boolean,Boolean) Method

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,String,Boolean,Int32) Method

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.

RenderScripts (IHtmlHelper) Method

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