This documentation is archived and is not being maintained.

ClientScriptManager::RegisterClientScriptInclude Method (String, String)

Registers the client script with the Page object using a key and a URL, which enables the script to be called from the client.

Namespace:  System.Web.UI
Assembly:  System.Web (in System.Web.dll)

public:
void RegisterClientScriptInclude(
	String^ key, 
	String^ url
)

Parameters

key
Type: System::String
The key of the client script include to register.
url
Type: System::String
The URL of the client script include to register.

A client script include is uniquely identified by its key and its type. Scripts with the same key and type are considered duplicates. Only one script with a given type and key pair can be registered with the page. Attempting to register a script that is already registered does not create a duplicate of the script.

Call the IsClientScriptIncludeRegistered method to determine whether a client script include with a given key and type pair is already registered and avoid unnecessarily attempting to add the script.

NoteNote

To resolve the client URL, use the ResolveClientUrl method. This method uses the context of the URL on which it is called to resolve the path.

This overload of the RegisterClientScriptInclude method calls the overload that takes a key, a URL, and a type parameter.

The method adds a script block at the top of the rendered page.

For related information, including syntax, usage, and an example, see RegisterClientScriptInclude(Type, String, String).

.NET Framework

Supported in: 4, 3.5, 3.0, 2.0

Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows XP SP2 x64 Edition, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.
Show: