System.Web.UI.ClientScriptManager.RegisterClientScriptInclude Method

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

Syntax

public void RegisterClientScriptInclude (string key, string url)

Parameters

key
The key of the client script include to register.
url
The URL of the client script include to register.

Remarks

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 erload:System.Web.UI.ClientScriptManager.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.

Note:

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

This overload of the erload:System.Web.UI.ClientScriptManager.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.

Requirements

Namespace: System.Web.UI
Assembly: System.Web (in System.Web.dll)
Assembly Versions: 2.0.0.0
Since: .NET 2.0