ASP.NET Pack Programmer's Guide
Button

The Button control can act as a regular HTML button, Link or ImageButton.

Server side

Customizing the control

You can specify the display type of the control by setting the DisplayType property. Set the UseSubmitBehavior property to specify whether the control should render as a submit button.

The ImageUrl and ActiveImageUrl properties can be used to specify either a background image or an icon to be displayed by the control.

Events

The following events are exposed by the Button class.

Event

Event arguments

Description

Click

EventArgs

Raised when the control is clicked.

Command

CommandEventArgs

Raised when the control is clicked.

Client side

Getting a reference to the control

You can access the control on the client side by its ClientID.

JavaScript  Copy Code

var button = $find("Button1");
var button = $find("<%= Button1.ClientID %>");

Events

The following client-side event are exposed by the Button class.

Event

Event arguments

Script property

Description

click

-

ClickScript

Raised when a control is clicked.

controlLoaded

-

ControlLoadedScript

Raised just after the control has finished loading and is ready for interaction.