ASP.NET HtmlInputImage Control
HTML Server Controls
Definition and Usage
The HtmlInputImage control is used to control the element. In HTML, this element is used to create a button that uses an image, as a replacement for a regular button.
property
| property | Description |
|---|---|
| Align | The alignment of the image. |
| Alt | Alternative text for the image to display. |
| Attributes | Returns all attribute name and value pairs of the element. |
| Border | The width of the border around the element. |
| Disabled | A Boolean value that indicates whether the control is disabled. The default is false. |
| id | The unique id of the control. |
| Name | The name of the element. |
| OnServerClick | The name of the function executed when the image is clicked. |
| runat | Specifies that this control is a server control. Must be set to "server". |
| Src | The source of the image. |
| Style | Sets or returns the CSS properties applied to this control. |
| TagName | Returns the tag name of the element. |
| Type | The type of the element. |
| Value | The value of the element. |
| Visible | A Boolean value that indicates whether the control is visible. |
Example
HTMLInputImage
In this example, we declare two HtmlInputImage controls and one HtmlGeneric control in the .aspx file (remember to nest the controls inside the HtmlForm control). If the user clicks the first image, the button1 subroutine is executed. This subroutine sends the message "You clicked the smiley button!" to the p element. If the user clicks the second image, the button2 subroutine is executed. This subroutine sends the message "You clicked the angry button!" to the p element.
HTML Server Controls