ASP.NET HtmlImage Control
HTML Server Controls
Definition and Usage
The HtmlImage control is used to control the element. In HTML,
element is used to display an image.
property
| property | Description |
|---|---|
| Align | How to align the image relative to surrounding elements. Valid values are:
|
Example
HTMLImage
In this example, we declare an HtmlImage control in the .aspx file (remember to nest the control inside the HtmlForm control). Then we modify the src, alt, and border attributes of this HtmlImage control in an event handler (a subroutine that executes code for a given event). The Page_Load event is one of the many events that ASP.NET understands.
HTMLImage 2
In this example, we declare an HtmlImage control and an HTMLSelect control in the .aspx file (remember to nest the controls inside the HtmlForm control). Then we modify the src attribute of the HtmlImage control based on the user's selection. The value selected in the HtmlSelect control determines which image is displayed.
HTML Server Controls