ASP.NET Button UseSubmitBehaviorProperty
Button Control
Definition and Usage
The UseSubmitBehavior property specifies whether the Button control uses the client browser's built-in submit functionality or the ASP.NET postback mechanism.
If the control uses the browser's submit functionality, the property is set to TRUE. Otherwise, it is FALSE. The default value is TRUE.
When UseSubmitBehavior is set to FALSE, ASP.NET adds a piece of client-side script to post back the form. In this case, control developers can use the GetPostBackEventReference method to return the Button's client-side postback event. The string returned by the GetPostBackEventReference method contains the text of a client-side function call, which can be inserted into a client-side event handler.
Syntax
Example
Example
The following example uses the ASP.NET postback mechanism:
Sub SubmitBtn(obj As Object, e As EventArgs)
lblMsg.Text = "Submitted using the ASP.NET postback mechanism."
End Sub
</script>
<form runat="server">
Click the button:
<asp:button id="Button1" runat="server"
Text="Submit" onclick="SubmitBtn"
UseSubmitBehavior="FALSE" /><br />
<asp:label id="lblMsg" runat="server"/>
</form>
Demo Example »
Button Control Other Extensions