ASP.NET ImageButton Control
Web Server Controls
Definition and Usage
The ImageButton control is used to display a clickable image.
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 | The command associated with 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 executed when the image is clicked. | 2.0 |
| PostBackUrl | The target page URL to which the ImageButton posts back from the current page when clicked. | 2.0 |
| runat | Specifies that this control is a server control. Must be set to "server". | 1.0 |
| TagKey | 1.0 | |
| ValidationGroup | The control group for which validation is triggered by this ImageButton control when it posts back to the server. | 2.0 |
Note: Image controlproperties 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。
Web Control Standard Properties
AppRelativeTemplateSourceDirectory, BindingContainer, ClientID, Controls, EnableTheming, EnableViewState, ID, NamingContainer, Page, Parent, Site, TemplateControl, TemplateSourceDirectory, UniqueID, Visible
For a complete description, please visit Web Control Standard Properties。
Example
ImageButton
In this example, we declare an ImageButton control and a Label control in the .aspx file. When the user clicks this image, the subroutine subroutine is executed. This subroutine sends the message "Coordinates: " and the clicked x and y coordinates to the Label control.
Web Server Controls