Documentation for: ASP.NET Ajax Version 1.0

This documentation is for a previous version. For the current released version, see the ASP.NET Ajax documentation on MSDN.

 

 

 

 

 

 

 

ScriptMode Enumeration

Specifies whether ScriptManager and ScriptReference objects refer to the debug or release version of client scripts.

Syntax

CSharp

public enum ScriptMode

VisualBasic

Public Enumeration ScriptMode

ManagedCPlusPlus

public enum class ScriptMode

JSharp

public enum ScriptMode

Members

MemberDescription
AutoIn the ScriptManager control, the version of client scripts to use is determined at run time based on the application-level compilation Element (ASP.NET Settings Schema) element of the Web.config file, unless it is overridden in an instance of the ScriptReference control. In the ScriptReference control, when applied to a standalone script file, Auto is equivalent to Release. When applied to a script reference in an assembly, Auto is equivalent to Inherit.
InheritIn the ScriptManager control, Inherit is equivalent to Auto. In the ScriptReference control, the ScriptMode value from ScriptManager determines which version of the client script to use.
DebugIn the ScriptManager control, the debug version of the client script is used on the Web page unless overridden in an instance of the ScriptReference control. In the ScriptReference control, the debug version of the client script is used on the Web page.
ReleaseIn the ScriptManager control, the release version of the client script is used on the Web page unless overridden by setting the ScriptMode property of a ScriptReference instance to Debug. In the ScriptReference control, the release version of the client script is used on the Web page.

Remarks

The ScriptMode enumerator provides values for setting which version of client script to use on a Web page. The enumerator values can be applied to either the ScriptMode property of the ScriptManager object, or to the ScriptMode property of the ScriptReference object. The ScriptManager object sets the version for all scripts on the page unless it is overridden by a ScriptReference object. The ScriptReference object sets the version for a particular script.

The Auto value produces different results depending on whether it refers to a standalone script file or to a script file that is embedded as a resource in an assembly. A standalone script file is defined with the Path property. An assembly reference must be accessed through the Name and Assembly properties. When applied to a standalone script file, the Auto value is equivalent to Release. When applied to a script reference in an assembly, Auto is equivalent to Inherit.

An error is thrown if the requested version of the script does not exist. For instance, an error is thrown if a reference is made to a standalone script file that is named CustomScript.js and ScriptMode is set to Debug, but CustomScript.debug.js does not exist on the site. References to scripts in an assembly return the release version if the debug version does not exist.

note

When the retail attribute of the deployment Element (ASP.NET Settings Schema) element of the Machine.config file is set to true, the release versions of client scripts are used throughout the Web site. The ScriptMode values in the ScriptManager and ScriptReference properties are ignored.

Examples

The following example shows a page where the script versions are declaratively set to Release in the ScriptManager control, but one script named CustomClient.js is declaratively set to Debug in the ScriptReference control.

cs

<asp:ScriptManager ID="SM" runat="server" ScriptMode="Release">
    <Scripts>
        <asp:ScriptReference Path="CustomClient.js" ScriptMode="Debug" />
    </Scripts>
</asp:ScriptManager>

vb

<asp:ScriptManager ID="SM" runat="server" ScriptMode="Release">
    <Scripts>
        <asp:ScriptReference Path="CustomClient.js" ScriptMode="Debug" />
    </Scripts>
</asp:ScriptManager>

Assembly: System.Web.Extensions (Module: System.Web.Extensions)