System.Web 2.0.0.0 System.Object The class is used to manage client scripts and add them to Web applications. You can get a reference to the class from the property of the object. You can add a client script to a Web page declaratively by including the script in the HTML markup of the page. However, there are situations when adding client script dynamically is needed. To add a script dynamically, use the method, the method, the method, or the method, depending on when and how you want to add the script. For more information, see How to: Add Client Script Dynamically to ASP.NET Web Pages. The class uniquely identifies scripts by a key and a . Scripts with the same key and type are considered duplicates. Using the script type helps to avoid confusing similar scripts from different user controls that might be in use on the page. The class can be used to invoke client callbacks in situations when it is desirable to run server code from the client without performing a postback. This is referred to as performing an out-of-band callback to the server. In a client callback, a client script function sends an asynchronous request to an ASP.NET Web page. The Web page runs a modified version of its normal life cycle to process the callback. Use the method to obtain a reference to a client function that, when invoked, initiates a client callback to a server event. For more information, see Client Callbacks Without Postbacks in ASP.NET Pages. Script callbacks will not work in older browsers that do not support the Document Object Model (DOM), and they require that ECMAScript is enabled on the client. To check if the browser supports callbacks, use the property, which is accessible through the property of the ASP.NET intrinsic object. Use the method and the method to define a client postback event. These methods enable client script functions, when invoked, to cause the server to post back to the page. A client postback event is different from a client callback in that the Web page completes a normal life cycle to process the client postback event. If you are using a control and the property is set to false, then you can use the method to return the client postback event for the control. The property of the control, control, and control can be used to run client script. Defines methods for managing client scripts in Web applications. Method System.String The method performs an out-of-band callback to the server that is a modified version of a page's normal life cycle. For more information, see Client Callbacks Without Postbacks in ASP.NET Pages. When the browser is Microsoft Internet Explorer (version 5.0 or later), the script callback mechanism is implemented through the Microsoft.XmlHttp COM object and requires the browser to be set to run ActiveX controls. For other browsers, an XMLHttpRequest using the browser's local Document Object Model (DOM) is used. To check whether a browser supports client callbacks, use the property. To check whether a browser supports XML over HTTP, use the property. Both properties are accessible through the property of the intrinsic ASP.NET object. The overload of the method performs a callback synchronously using XML over HTTP. When sending data synchronously in a callback scenario, synchronous callbacks return immediately and do not block the browser. No two synchronous callbacks callback can execute at the same time in the browser. If a second synchronous callback is fired while one is currently pending, the second synchronous callback cancels the first and only the second callback will return. To send data asynchronously, use one of the overloads that takes the parameter, which is a Boolean value controlling this behavior. In the asynchronous scenario you can have multiple pending callbacks; however, the order in which they return is not guaranteed to match the order in which they were initiated. Additionally, this overload of the method specifies no client function to handle the case of an error condition generated by the method. To specify a client error callback handler, use one of the overloads that takes the parameter. The method takes an optional string parameter and returns a string. To pass in or to receive multiple values, concatenate values in the input or return string, respectively. Avoid using the view state in the implementation of page or control properties that need be updated during script callback operations. If the properties are to survive page requests, you can use session state. Obtains a reference to a client function that, when invoked, initiates a client call back to a server event. The client function for this overloaded method includes a specified control, argument, client script, and context. The name of a client function that invokes the client callback. The server that handles the client callback. The control must implement the interface and provide a method. An argument passed from the client script to the server The name of the client event handler that receives the result of the successful server event. The client script that is evaluated on the client prior to initiating the callback. The result of the script is passed back to the client event handler. 2.0.0.0 Method System.String This overload of the method requires a parameter, which allows you to perform the client callback asynchronously by setting the value to true. The overload versions of this method that do not require the parameter set the value to false by default. For more information on this method, see the remarks for the overload method. Obtains a reference to a client function that, when invoked, initiates a client call back to server events. The client function for this overloaded method includes a specified control, argument, client script, context, and Boolean value. The name of a client function that invokes the client callback. The server that handles the client callback. The control must implement the interface and provide a method. An argument passed from the client script to the server The name of the client event handler that receives the result of the successful server event. The client script that is evaluated on the client prior to initiating the callback. The result of the script is passed back to the client event handler. true to perform the callback asynchronously; false to perform the callback synchronously. 2.0.0.0 Method System.String This overload of the method takes a string parameter instead of a parameter. Use this overload when you want the callback to go back to something other than a string containing the of the control. Additionally, this overload of the method requires a and a parameter. The parameter allows you to perform the client callback asynchronously by setting the value to true. The overload versions of this method that do not require the parameter set the value to false by default. The parameter allows you to define the name of the client function that is called if the server handler, the method, returns an error. The overload versions of this method that do not require the parameter set the value to null. For more information on this method, see the remarks for the overload method. Obtains a reference to a client function that, when invoked, initiates a client call back to server events. The client function for this overloaded method includes a specified target, argument, client script, context, error handler, and Boolean value. The name of a client function that invokes the client callback. The name of a server that handles the client callback. The control must implement the interface and provide a method. An argument passed from the client script to the server The name of the client event handler that receives the result of the successful server event. The client script that is evaluated on the client prior to initiating the callback. The result of the script is passed back to the client event handler. The name of the client event handler that receives the result when an error occurs in the server event handler. true to perform the callback asynchronously; false to perform the callback synchronously. 2.0.0.0 Method System.String This overload of the method requires a and a parameter. The parameter allows you to perform the client callback asynchronously by setting the value to true. The overload versions of this method that do not require the parameter set the value to false by default. The parameter allows you to define the name of the client function that is called if the server handler (the method) returns an error. The overload versions of this method that do not require the parameter set the value to null. For more information on this method, see the remarks for the overload method. Obtains a reference to a client function that, when invoked, initiates a client call back to server events. The client function for this overloaded method includes a specified control, argument, client script, context, error handler, and Boolean value. The name of a client function that invokes the client callback. The server that handles the client callback. The control must implement the interface and provide a method. An argument passed from the client script to the server method. The name of the client event handler that receives the result of the successful server event. The client script that is evaluated on the client prior to initiating the callback. The result of the script is passed back to the client event handler. The name of the client event handler that receives the result when an error occurs in the server event handler. true to perform the callback asynchronously; false to perform the callback synchronously. 2.0.0.0 Method System.String Using the method requires the control that handles the postback to implement the interface. To implement the interface for a , use the @ Implements directive. Gets a reference, with javascript: appended to the beginning of it, that can be used in a client event to post back to the server for the specified control and with the specified event arguments. A string representing a JavaScript call to the postback function that includes the target control's ID and event arguments. The server control to process the postback. The parameter passed to the server control. 2.0.0.0 Method System.String Using the method requires the control that handles the postback to implement the interface. To implement the interface for a , use the @ Implements directive. Gets a reference, with javascript: appended to the beginning of it, that can be used in a client event to post back to the server for the specified control with the specified event arguments and Boolean indication whether to register the post back for event validation. A string representing a JavaScript call to the postback function that includes the target control's ID and event arguments. The server control to process the postback. The parameter passed to the server control. true to register the postback event for validation; false to not register the post back event for validation. 2.0.0.0 Method System.String To implement the interface for a , use the @ Implements directive. The method can be used with the control when the property is false. In this scenario, the method returns the client postback event for the control. Returns a string that can be used in a client event to cause postback to the server. The reference string is defined by the specified instance. A string that, when treated as script on the client, initiates the client postback. A that defines the postback. 2.0.0.0 Method System.String To implement the interface for a , use the @ Implements directive. The method can be used with the control when the property is false. In this scenario, the method returns the client postback event for the control. Returns a string that can be used in a client event to cause postback to the server. The reference string is defined by the specified control that handles the postback and a string argument of additional event information. A string that, when treated as script on the client, initiates the postback. The server that processes the postback on the server. A string of optional arguments to pass to the control that processes the postback. 2.0.0.0 Method System.String To implement the interface for a object, use the @ Implements directive. The method can be used with the control when the property is false. In this scenario, the method returns the client postback event for the control. If is true, the method calls the method to register the event reference for validation with a unique control ID that represents the client control that is generating the event. Returns a string that can be used in a client event to cause postback to the server. The reference string is defined by the specified object. Optionally, registers the event reference for validation. A string that, when treated as script on the client, initiates the client postback. A that defines the postback. true to register the event reference for validation; otherwise, false. 2.0.0.0 Method System.String To implement the interface for a , use the @ Implements directive. The method can be used with the control when the property is false. In this scenario, the method returns the client postback event for the control. If is true, the method calls the method to register the event reference for validation with a unique control ID that represents the client control that is generating the event. Returns a string to use in a client event to cause postback to the server. The reference string is defined by the specified control that handles the postback and a string argument of additional event information. Optionally, registers the event reference for validation. A string that, when treated as script on the client, initiates the postback. The server that processes the postback on the server. A string of optional arguments to pass to . true to register the event reference for validation; otherwise, false. 2.0.0.0 Method System.String The method returns a URL reference to a resource embedded in an assembly. The returned reference is not URL encoded. Resources can be script files, images, or any static file. You specify the type based on the object that will be accessing the resource. A Web resource registered with the page is uniquely identified by its type and name. Only one resource with a given type and name pair can be registered with the page. Attempting to register a resource that is already registered does not create a duplicate of the registered resource. The method is used in conjunction with the method for accessing resources embedded in assemblies. For more information on using resources in applications, see ASP.NET Web Page Resources Overview. Gets a URL reference to a resource in an assembly. The URL reference to the resource. The type of the resource. The fully qualified name of the resource in the assembly. 2.0.0.0 Method System.Boolean Call this method before calling the method to avoid registering duplicate scripts. This is particularly important if the script requires a large amount of server resources to create. A client script is uniquely identified by its key and its type. Scripts with the same key and type are considered duplicates. This overload of the method calls the overload that takes both a and a parameter with the type set as a object Determines whether the client script block is registered with the object using the specified key. true if the client script block is registered; otherwise, false. The key of the client script block to search for. 2.0.0.0 Method System.Boolean Call this method before calling the method to avoid registering duplicate scripts. This is particularly important if the script requires a large amount of server resources to create. A client script is uniquely identified by its key and its type. Scripts with the same key and type are considered duplicates. You specify the type based on the object that will be accessing the resource. For instance, when using a Page instance to access the resource, you specify the Page type. Determines whether the client script block is registered with the object using a key and type. true if the client script block is registered; otherwise, false. The type of the client script block to search for. The key of the client script block to search for. 2.0.0.0 Method System.Boolean Call this method before calling the method to avoid registering duplicate scripts. This is particularly important if the script requires a large amount of server resources to create. A client script include is uniquely identified by its key and its type. Scripts with the same key and type are considered duplicates. This overload of the method calls the overload that takes both a and a parameter with the type set as a object. Determines whether the client script include is registered with the object using the specified key. true if the client script include is registered; otherwise, false. The key of the client script include to search for. 2.0.0.0 Method System.Boolean Call this method before calling the method to avoid registering duplicate client script includes. This is particularly important if the script requires a large amount of server resources to create. A client script include is uniquely identified by its key and its type. Scripts with the same key and type are considered duplicates. You specify the type based on the object that will be accessing the resource. For instance, when using a Page instance to access the resource, you specify the Page type. Determines whether the client script include is registered with the object using a key and type. true if the client script include is registered; otherwise, false. The type of the client script include to search for. The key of the client script include to search for. 2.0.0.0 Method System.Boolean Call this method before calling the method to avoid registering duplicate OnSubmit statements. This is particularly important if the statement requires a large amount of server resources to create. A statement is uniquely identified by its key and its type. Statements with the same key and type are considered duplicates. This overload of the method calls the overload that takes both a and a parameter with the type set as a object Determines whether the OnSubmit statement is registered with the object using the specified key. true if the OnSubmit statement is registered; otherwise, false. The key of the OnSubmit statement to search for. 2.0.0.0 Method System.Boolean Call this method before calling the method to avoid registering duplicate statements. This is particularly important if the statement requires a large amount of server resources to create. A statement is uniquely identified by its key and its type. Statements with the same key and type are considered duplicates. You specify the type based on the object that will be accessing the resource. For instance, when using a Page instance to access the resource, you specify the Page type. Determines whether the OnSubmit statement is registered with the object using the specified key and type. true if the OnSubmit statement is registered; otherwise, false. The type of the OnSubmit statement to search for. The key of the OnSubmit statement to search for. 2.0.0.0 Method System.Boolean Call this method before calling the method to avoid registering duplicate scripts. This is particularly important if the script requires a large amount of server resources to create. A startup script is uniquely identified by its key and its type. Scripts with the same key and type are considered duplicates. This overload of the method calls the overload that takes both a string and a parameter with the type set as a object Determines whether the startup script is registered with the object using the specified key. true if the startup script is registered; otherwise, false. The key of the startup script to search for. 2.0.0.0 Method System.Boolean Call this method before calling the method to avoid registering duplicate scripts. This is particularly important if the script requires a large amount of server resources to create. A client startup script is uniquely identified by its key and its type. Scripts with the same key and type are considered duplicates. Determines whether the startup script is registered with the object using the specified key and type. true if the startup script is registered; otherwise, false. The type of the startup script to search for. The key of the startup script to search for. 2.0.0.0 Method System.Void The checks to see whether a registered array exists with the same name as the name specified in the parameter and, if so, adds the values specified in the parameter. Because the underlying storage mechanism is based on an , duplicates are allowed. If a registered array with the same name as the parameter does not exist, it is created and the values in the parameter added to it. If you want string literals in the resulting JavaScript array, include single quotation marks (') or escaped double quotation marks (\") in the parameter. The value of the parameter should be a single element. If more than one value needs to be added to the array, make multiple calls using the method. Registers a JavaScript array declaration with the object using an array name and array value. The array name to register. The array value or values to register. 2.0.0.0 Method System.Void A client script 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 method to determine whether a client script with a given key and type pair is already registered and avoid unnecessarily attempting to add the script. In this overload of the method, you must make sure that the script provided in the parameter is wrapped in a <script> element block. The method adds a script block to the top of the rendered page. The script blocks are not guaranteed to be output in the order they are registered. If the order of the script blocks is important, use a object to gather the scripts together in a single string, and then register them all in a single client script block. Registers the client script with the object using a type, key, and script literal. The type of the client script to register. The key of the client script to register. The client script literal to register. 2.0.0.0 Method System.Void A client script 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 method to determine whether a client script with a given key and type pair is already registered. This lets you avoid unnecessarily attempting to add the script. In this overload of the method, you can indicate whether the script provided in the parameter is wrapped with a <script> element block by using the parameter. Setting to true indicates that script tags will be added automatically. The method adds a script block to the top of the rendered page. The script blocks are not guaranteed to be output in the order they are registered. If the order of the script blocks is important, use a object to gather the scripts together in a single string, and then register them all in a single client script block. Registers the client script with the object using a type, key, script literal, and Boolean value indicating whether to add script tags. The type of the client script to register. The key of the client script to register. The client script literal to register. A Boolean value indicating whether to add script tags. 2.0.0.0 Method System.Void 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 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. To resolve the client URL, use the method. This method uses the context of the URL on which it is called to resolve the path. This overload of the method calls the overload that takes a , a , and a parameter. The method adds a script block at the top of the rendered page. Registers the client script with the object using a key and a URL, which enables the script to be called from the client. The key of the client script include to register. The URL of the client script include to register. 2.0.0.0 Method System.Void This overload of the method takes key and url parameters to identify the script, as well as a parameter to specify the identification of the client script include. You specify the type based on the object that will be accessing the resource. For instance, when using a Page instance to access the resource, you specify the Page type. To resolve the client URL, use the method. This method uses the context of the URL on which it is called to resolve the path. This method adds a script block at the top of the rendered page. Registers the client script include with the object using a type, a key, and a URL. The type of the client script include to register. The key of the client script include to register. The URL of the client script include to register. 2.0.0.0 Method System.Void The method is used when accessing compiled-in resources from assemblies through the WebResource.axd HTTP handler. The method registers the script with the object and prevents duplicate scripts. This method wraps the contents of the resource URL with a <script> element block. Registers the client script resource with the object using a type and a resource name. The type of the client script resource to register. The name of the client script resource to register. 2.0.0.0 Method System.Void The method registers a name/value pair as a custom (expando) attribute on the specified . The expando attribute is set dynamically from JavaScript to preserve XHTML compatibility for the rendered control's markup. Quotes and backslashes in the custom (expando) attribute's values are escaped. If you do not want to escape quotes and backslashes, call the overload method and set the parameter to false. If the expando attribute is not found or the control to add the expando attribute to is not found, the client script is still emitted, but it will not affect the control. Registers a name/value pair as a custom (expando) attribute of the specified control given a control ID, attribute name, and attribute value. The on the page that contains the custom attribute. The name of the custom attribute to register. The value of the custom attribute. 2.0.0.0 Method System.Void The method registers a name/value pair as a custom (expando) attribute on the specified . The expando attribute is set dynamically from JavaScript to preserve XHTML compatibility for the rendered control's markup. Set the parameter to true if you need to escape quotes and backslashes in your expando attribute's value. If the expando attribute is not found or the control to add the expando attribute to is not found, the client script is still emitted, but it will not affect the control. Registers a name/value pair as a custom (expando) attribute of the specified control given a control ID, an attribute name, an attribute value, and a Boolean value indicating whether to encode the attribute value. The on the page that contains the custom attribute. The name of the custom attribute to register. The value of the custom attribute. A Boolean value indicating whether to encode the custom attribute to register. 2.0.0.0 Method System.Void For more information and examples, see the method. Registers an event reference for validation with a unique control ID representing the client control generating the event. A unique ID representing the client control generating the event. 2.0.0.0 Method System.Void For more information and examples, see the method. Registers an event reference for validation with . A object that specifies how client JavaScript is generated to initiate a postback event. 2.0.0.0 Method System.Void To be added. Registers an event reference for validation with a unique control ID and event arguments representing the client control generating the event. A unique ID representing the client control generating the event. Event arguments passed with the client event. 2.0.0.0 Method System.Void The method creates a hidden <input> element on the rendered HTML page. Registers a hidden value with the object. The name of the hidden field to register. The initial value of the field to register. 2.0.0.0 Method System.Void An OnSubmit statement is uniquely identified by its key and its type. Statements with the same key and type are considered duplicates. Only one statement with a given type and key pair can be registered with the page. Attempting to register a statement that is already registered will not create a duplicate of the statement. Call the method to determine whether an OnSubmit statement is already registered with a given key and type pair and avoid unnecessarily attempting to add the script. The parameter of the method can contain multiple script commands as long as they are properly delimited with a semicolon (;). The adds a script that is executed before the page is submitted and gives you an opportunity to cancel the submission. For more information on HTML forms and the OnSubmit attribute, see the World Wide Web Consortium (W3C) Web site. Registers an OnSubmit statement with the object using a type, a key, and a script literal. The statement executes when the is submitted. The type of the OnSubmit statement to register. The key of the OnSubmit statement to register. The script literal of the OnSubmit statement to register. 2.0.0.0 Method System.Void A client script 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 method to determine whether a startup script with a given key and type pair is already registered and avoid unnecessarily attempting to add the script. In this overload of the method, you must make sure that the script provided in the parameter is wrapped with a <script> element block. The script block added by the method executes when the page finishes loading but before the page's event is raised. The script blocks are not guaranteed to be output in the order they are registered. If the order of the script blocks is important, use a object to gather the scripts together in a single string, and then register them all in a single client script block. Registers the startup script with the object using a type, a key, and a script literal. The type of the startup script to register. The key of the startup script to register. The startup script literal to register. 2.0.0.0 Method System.Void A startup script 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 method to determine whether a startup script with a given key and type pair is already registered and avoid unnecessarily attempting to add the script. In this overload of the method, you can indicate whether the script provided in the parameter is wrapped with a <script> element block by using the parameter. Setting to true indicates that script tags will be added automatically. The script block added by the method executes when the page finishes loading but before the page's event is raised. The script blocks are not guaranteed to be output in the order they are registered. If the order of the script blocks is important, use a object to gather the scripts together in a single string, and then register them all in a single client script block. Registers the startup script with the object using a type, a key, a script literal, and a Boolean value indicating whether to add script tags. The type of the startup script to register. The key of the startup script to register. The startup script literal to register. A Boolean value indicating whether to add script tags. 2.0.0.0 Method System.Void To be added. Validates a client event that was registered for event validation using the method. A unique ID representing the client control generating the event. 2.0.0.0 Method System.Void To be added. Validates a client event that was registered for event validation using the method. A unique ID representing the client control generating the event. The event arguments passed with the client event. 2.0.0.0