ASP.NET ImageButton Control

Definition and Usage

The ImageButton control is used to display clickable images.

Property

Property Description .NET
CausesValidation Specifies whether the page is validated when the ImageButton control is clicked. 1.0
CommandArgument Additional information about the command to be executed. 1.0
CommandName Command related to the Command event. 1.0
GenerateEmptyAlternateText Specifies whether the control creates an empty string as alternative text. 2.0
OnClientClick The name of the function to be executed when the image is clicked. 2.0
PostBackUrl The URL of the target page that is posted back from the current page when the ImageButton is clicked. 2.0
runat Specifies that the control is a server control. It must be set to "server". 1.0
TagKey 1.0
ValidationGroup When the ImageButton returns to the server, the ImageButton control causes the validation group for the control to be validated. 2.0

Note:The properties of the Image control can also be used on the ImageButton control.

Web Control Standard Properties

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

For a complete description, please visit Web Control Standard Properties.

Control Standard Properties

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

For a complete description, please visitControl Standard Properties.

Example

ImageButton
In this example, we declare an ImageButton control and a Label control in the .aspx file. When the user clicks on this image, the subroutine subroutine will be executed. This subroutine will send the message "Coordinates: " and the x and y coordinates of the click to the Label control.