Registers ECMAScript (JavaScript) code for a control that is inside an UpdatePanel control that is executed when the form is submitted.
Syntax
CSharp
VisualBasic
Public Shared Sub RegisterOnSubmitStatement ( _
control As Control, _
type As Type, _
key As String, _
script As String _
)
ManagedCPlusPlus
JSharp
Parameters
- control (Control)
The control that is registering the OnSubmit statement.
- type (Type)
The type of the client script statement. This parameter is usually specified by using the typeof (C# Reference) operator (C#) or the GetType Operator operator (Visual Basic) to retrieve the type of the control that is registering the script.
- key (String)
The string that uniquely identifies the script statement.
- script (String)
The script literal.
Remarks
The RegisterOnSubmitStatement method is used to render an onsubmit statement that is compatible with partial-page rendering and that has no Microsoft AJAX Library dependencies. JavaScript code that is registered with this method is sent to the page only when the control that is registering the statement is inside an UpdatePanel control that is updated. To register code with every asynchronous postback, use the RegisterOnSubmitStatement(Page, Type, String, String) overload of this method. If your page or part of the page is not using partial-page updates and you want to register JavaScript code only one time during initial page rendering, use the RegisterOnSubmitStatement(String, String) method of the ClientScriptManager class. You can get a reference to the ClientScriptManager object from the ClientScript property of the page.
The script parameter of the RegisterOnSubmitStatement method can contain multiple script commands that are delimited with semicolons (;).
The RegisterOnSubmitStatement adds script that is executed before the page is submitted and gives you the opportunity to modify the submission or cancel it.
For more information on HTML forms and the onsubmit event, see the World Wide Web Consortium (W3C) Web site.
Exceptions
Assembly: System.Web.Extensions (Module: System.Web.Extensions)