ClientScriptManager::RegisterOnSubmitStatement Method
Assembly: System.Web (in System.Web.dll)
Parameters
- type
- Type: System::Type
The type of the OnSubmit statement to register.
- key
- Type: System::String
The key of the OnSubmit statement to register.
- script
- Type: System::String
The script literal of the OnSubmit statement to register.
| Exception | Condition |
|---|---|
| ArgumentNullException | type is nullptr. |
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 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 RegisterOnSubmitStatement method can contain multiple script commands as long as they are properly delimited with a semicolon (;).
The RegisterOnSubmitStatement 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.
Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows XP SP2 x64 Edition, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2
The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.