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.
Assembly: System.Web (in System.Web.dll)
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.
Note |
|---|
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.
Available since 2.0
