Back to Devexpress

ExtensionsFactory.GetScripts(Script[]) Method

aspnetmvc-devexpress-dot-web-dot-mvc-dot-ui-dot-extensionsfactory-dot-getscripts-x28-devexpress-dot-web-dot-mvc-dot-ui-dot-script-x29.md

latest3.4 KB
Original Source

ExtensionsFactory.GetScripts(Script[]) Method

Returns the HTML code representing the rendering of the specified scripts.

Namespace : DevExpress.Web.Mvc.UI

Assembly : DevExpress.Web.Mvc5.v25.2.dll

NuGet Package : DevExpress.Web.Mvc5

Declaration

csharp
public MvcHtmlString GetScripts(
    params Script[] scriptItems
)
vb
Public Function GetScripts(
    ParamArray scriptItems As Script()
) As MvcHtmlString

Parameters

NameTypeDescription
scriptItemsScript[]

An array of Script objects defining the attached scripts.

|

Returns

TypeDescription
MvcHtmlString

A MvcHtmlString object representing the HTML-encoded string.

|

Remarks

Use the GetScripts method to attach the scripts required for the DevExpress ASP.NET MVC extensions.

If the resources section of an application’s Web.config file contains a reference to the ThirdParty and/or DevExtreme libraries, the GetScripts method will attach the corresponding libraries and additional resources to the View.

xml
<devExpress>
    <!-- ... -->
    <resources>
        <add type="ThirdParty" />
        <add type="DevExtreme" />
    </resources>
</devExpress>

For more information about this configuration option and a complete list of the scripts attached to each extension suite, see External Client Libraries.

Example

The following example demonstrates how to attach the DevExpress MVC Extensions’ scripts to the View.

cshtml
<head>
    ...
    @Html.DevExpress().GetScripts( 
        new Script { ExtensionSuite = ExtensionSuite.NavigationAndLayout }, 
        new Script { ExtensionSuite = ExtensionSuite.HtmlEditor }, 
        new Script { ExtensionSuite = ExtensionSuite.GridView }, 
        new Script { ExtensionSuite = ExtensionSuite.PivotGrid },
        new Script { ExtensionSuite = ExtensionSuite.Editors }, 
        new Script { ExtensionSuite = ExtensionSuite.Chart },
        new Script { ExtensionSuite = ExtensionSuite.Report },
        new Script { ExtensionSuite = ExtensionSuite.Scheduler },
        new Script { ExtensionSuite = ExtensionSuite.TreeList }
    )
    ...
</head>

See Also

RenderScripts(Page, Script[])

Manual Integration into an Existing Project

ExtensionsFactory Class

ExtensionsFactory Members

DevExpress.Web.Mvc.UI Namespace