ASP.NET HtmlInputImageControl
HTML Server Controls
Definition and Usage
The HtmlInputImage control is used to control the <input type="image"> element. In HTML, this element is used to create buttons that use images, which can replace conventional buttons.
Attributes
| Attribute | Description |
|---|---|
| Align | The alignment of the image. |
| Alt | Alternative text for the image to be displayed. |
| Attributes | Returns all attribute name and value pairs for the element. |
| Border | The width of the border around the element. |
| Disabled | A Boolean value indicating 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 to be executed when the image is clicked. |
| runat | Specifies whether the 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 the 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 indicating whether the control is visible. |
Examples
HTMLInputImage
In this example, we declare two HtmlInputImage controls and one HtmlGeneric control in the .aspx file (remember to nest the controls in the HtmlForm control). If the user clicks the first image, the button1 subroutine will be 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 will be executed. This subroutine sends the message "You clicked the angry button!" to the p element.
HTML Server Controls Other Extensions