Page.IsStartupScriptRegistered(String) Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Caution
The recommended alternative is ClientScript.IsStartupScriptRegistered(string key). http://go.microsoft.com/fwlink/?linkid=14202
Determines whether the client startup script is registered with the Page object.
public:
bool IsStartupScriptRegistered(System::String ^ key);
public bool IsStartupScriptRegistered(string key);
[System.Obsolete("The recommended alternative is ClientScript.IsStartupScriptRegistered(string key). http://go.microsoft.com/fwlink/?linkid=14202")]
public bool IsStartupScriptRegistered(string key);
member this.IsStartupScriptRegistered : string -> bool
[]
member this.IsStartupScriptRegistered : string -> bool
Public Function IsStartupScriptRegistered (key As String) As Boolean
Parameters
- key
- String
The string key of the startup script to search for.
Returns
true if the startup script is registered; otherwise, false.
- Attributes
Examples
The following code example demonstrates the use of the RegisterStartupScript method in conjunction with the IsStartupScriptRegistered method. If the ECMAScript written in the code declaration block has not already been registered, as determined by IsStartupScriptRegistered, then a RegisterStartupScript call is made.
<%@ Page Language="C#"%>
RegisterClientScriptBlock Example
<%@ Page Language="VB" %>
RegisterClientScriptBlock Example
Remarks
Call this method before calling Page.RegisterStartupScript to avoid unnecessarily assembling the client-side script. This is particularly important if the script requires a large amount of server resources to create.
The IsStartupScriptRegistered method has been deprecated. Use the IsStartupScriptRegistered method in the ClientScriptManager class.