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 Property

Gets or sets the version of the client script file (release or debug) to use.

Syntax

CSharp

[CategoryAttribute("Behavior")]
[DefaultValueAttribute(ScriptMode.Auto)]
public ScriptMode ScriptMode { get; set; }

VisualBasic

<CategoryAttribute("Behavior")> _
<DefaultValueAttribute(ScriptMode.Auto)> _
Public Property ScriptMode As ScriptMode

ManagedCPlusPlus

[CategoryAttribute(L"Behavior")]
[DefaultValueAttribute(ScriptMode::Auto)]
public:
ScriptMode ScriptMode {
	ScriptMode get ();
	void set (ScriptMode value);
}

JSharp

/** @property */
/** @property */

Value

Return Value

A ScriptMode value that indicates which version of the client script file is referenced. The default is Auto.

Remarks

You use the ScriptMode property to specify whether the debug or release version of the referenced script file is used on a Web page. You can set the ScriptMode value in the ScriptReference object to a different value from the ScriptMode value in the ScriptManager object. You can do this to specify a version of the script separately from the other scripts on the Web page. You set ScriptMode to Inherit when you want the ScriptReference object to get its ScriptMode value from the ScriptManager control.

For a standalone client script file that is not embedded in an assembly, Auto is equivalent to Release. For an embedded script file in an assembly, Auto is equivalent to Inherit.

Always set the Path property to the name of the release version of the client script file. When ScriptMode is set to Debug, the ScriptManager object automatically searches for the debug version by changing the file name from file.js to file.debug.js.

note

When the retail attribute of the deployment Element (ASP.NET Settings Schema) element in the configuration file is true, the release versions of client script files are used throughout the Web site. In that case, the value of the ScriptMode property is ignored.

Examples

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

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>

See Also

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