Latest web development tutorials

ASP.NET Button UseSubmitBehavior property

Button controls Button controls

Definition and Usage

UseSubmitBehavior attribute specifies the Button control uses the client browser's built-commit feature, or use the ASP.NET postback mechanism.

If the control is to use the browser to submit features, the property is set to TRUE. Otherwise FALSE. The default value is TRUE.

When set to FALSE UseSubmitBehavior, ASP.NET adds a client-side script to post the form. At this time control developers can use the method to return Button GetPostBackEventReference client postback event. GetPostBackEventReference method returns a string containing the text client function calls that can be inserted into the client-side event handler.

grammar

<asp:Button UseSubmitBehavior="TRUE|FALSE" runat="server" />


Examples

Examples

The following example uses the ASP.NET postback mechanism:

<script runat="server">
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>

The demonstration >>


Button controls Button controls