System.Web.UI.ClientScriptManager.RegisterOnSubmitStatement Method

Registers an OnSubmit statement with the System.Web.UI.Page object using a type, a key, and a script literal. The statement executes when the System.Web.UI.HtmlControls.HtmlForm is submitted.

Syntax

public void RegisterOnSubmitStatement (Type type, string key, string script)

Parameters

type
The type of the OnSubmit statement to register.
key
The key of the OnSubmit statement to register.
script
The script literal of the OnSubmit statement to register.

Remarks

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 erload:System.Web.UI.ClientScriptManager.IsOnSubmitStatementRegistered 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 script parameter of the ClientScriptManager.RegisterOnSubmitStatement(Type, string, string) method can contain multiple script commands as long as they are properly delimited with a semicolon (;).

The ClientScriptManager.RegisterOnSubmitStatement(Type, string, string) 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 tp://go.microsoft.com/fwlink/?linkid=37125.

Requirements

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