This documentation is archived and is not being maintained.

Button.UseSubmitBehavior Property

Gets or sets a value indicating whether the Button control uses the client browser's submit mechanism or the ASP.NET postback mechanism.

Namespace:  System.Web.UI.WebControls
Assembly:  System.Web (in System.Web.dll)

public virtual bool UseSubmitBehavior { get; set; }
<asp:Button UseSubmitBehavior="True|False" />

Property Value

Type: System.Boolean
true if the control uses the client browser's submit mechanism; otherwise, false. The default is true.

Use the UseSubmitBehavior property to specify whether a Button control uses the client browser's submit mechanism or the ASP.NET postback mechanism. By default the value of this property is true, causing the Button control to use the browser's submit mechanism. If you specify false, the ASP.NET page framework adds client-side script to the page to post the form to the server.

When the UseSubmitBehavior property is false, control developers can use the GetPostBackEventReference method to return the client postback event for the Button. The string returned by the GetPostBackEventReference method contains the text of the client-side function call and can be inserted into a client-side event handler.

This property cannot be set by themes or style sheet themes. For more information, see ThemeableAttribute and ASP.NET Themes and Skins Overview.

The following code example demonstrates how to use the UseSubmitBehavior property to specify the submit mechanism that a Button control uses when it posts back to the server. The UseSubmitBehavior property is set to false, causing the button to use the ASP.NET postback mechanism. If you view the source code for the rendered page using your browser's View Source command, you will see that client-side script has been added by the ASP.NET page framework to post the form to the server.

<%@ page language="C#" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
<script runat="server">

  void SubmitBtn_Click(object sender, EventArgs e)
    Message.Text = "Hello World!";    


<html xmlns="" >
<head id="head1" runat="server">
  <title>Button.UseSubmitBehavior Example</title>
  <form id="form1" runat="server">

    <h3>Button.UseSubmitBehavior Example</h3> 

    Click the Submit button.

    <br /><br /> 

    <!--The value of the UseSubmitBehavior property
    is false. Therefore the button uses the ASP.NET 
    postback mechanism.-->
    <asp:button id="Button1"

    <br /><br /> 

    <asp:label id="Message" 


Windows 7, Windows Vista, Windows XP SP2, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP Starter Edition, Windows Server 2008 R2, Windows Server 2008, Windows Server 2003, Windows Server 2000 SP4, Windows Millennium Edition, Windows 98

The .NET Framework and .NET Compact Framework do not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

.NET Framework

Supported in: 3.5, 3.0, 2.0