ASP.NET Button control

Definition and usage

The Button control is used to display buttons. The button can be a submit button or a command button. By default, the control is a submit button.

The submit button does not have a command name, and when it is clicked, it will send the web page back to the server. You can write event handlers to control the actions to be performed when the submit button is clicked.

The command button has a command name and allows you to create multiple button controls on the page. You can write event handlers to control the actions to be performed when the command button is clicked.

Property

Property Description .NET
CausesValidation Specifies whether the page is validated when the Button is clicked. 1.0
CommandArgument Additional information about the command to be executed. 1.0
CommandName Command related commands. 1.0
OnClientClick The name of the function to be executed when the button is clicked. 2.0
PostBackUrl The target page URL from which data is sent to the current page when the Button control is clicked. 2.0
runat Specifies that the control is a server control. It must be set to "server". 1.0
Text The text on the button. 1.0
UseSubmitBehavior A value indicating whether the Button control uses the browser's submission mechanism or the ASP.NET postback mechanism. 2.0
ValidationGroup When the Button control returns to the server, which control group of the Button caused the validation. 2.0

Web Denetleyici Standart Özellikleri

AccessKey, Attributes, BackColor, BorderColor, BorderStyle, BorderWidth, 
CssClass, Enabled, Font, EnableTheming, ForeColor, Height, IsEnabled, 
SkinID, Style, TabIndex, ToolTip, Width

Tam bir açıklama için ziyaret edin Web Denetleyici Standart Özellikleri.

Denetleyici Standart Özellikleri

AppRelativeTemplateSourceDirectory, BindingContainer, ClientID, Controls, 
EnableTheming, EnableViewState, ID, NamingContainer, Page, Parent, Site, 
TemplateControl, TemplateSourceDirectory, UniqueID, Visible

Tam bir açıklama için ziyaret edinDenetleyici Standart Özellikleri.

Örnek

Button
Bu örnekte, .aspx dosyasında bir gönderim Button denetleyicisi tanımladık. Daha sonra, Click olayı gerçekleştiğinde buton üzerindeki metni değiştirebilecek bir olay işleyicisi oluşturduk.
Button 2
Bu örnekte, .aspx dosyasında bir gönderim Button denetleyicisi tanımladık. Daha sonra, Click olayı gerçekleştiğinde buton metnini ve stili değiştirebilecek bir olay işleyicisi oluşturduk.