ASP.NET HtmlImage Controls
Definition and Usage
HtmlImage control for controlling the <img> element. In HTML, <img> element is used to display images.
Attributes
属性 | 描述 |
---|---|
Align | 如何根据周围的元素排列图像。合法值有:
|
Alt | 图像的简短描述。 |
Attributes | 返回该元素的所有属性名称和值对。 |
Border | 图像周围的边框的宽度。 |
Disabled | 布尔值,指示是否禁用该控件。默认是 false。 |
Height | 图像的高度。 |
id | 控件的唯一 id。 |
runat | 规定该控件是一个服务器控件。必须被设置为 "server"。 |
Src | 要显示的图像的 URL。 |
Style | 设置或返回被应用到该控件的 CSS 属性。 |
TagName | 返回元素的标签名。 |
Visible | 布尔值,指示该控件是否可见。 |
Width | 图像的宽度。 |
Examples
HTMLImage
In this example, we declare a HtmlImage control (remember to control nested HtmlForm control) in an .aspx file. Then we modify the src, alt and border control in the properties of this HtmlImage an event handler (an event handler for a given event to execute code subroutine) in. Page_Load event is one of many events ASP .NET understandable.
HTMLImage 2
In this example, we declare a HtmlImage control and a HTMLSelect control (remember to control nested HtmlForm control) in an .aspx file. Then we select based on the user to modify the src attribute HtmlImage control. In HtmlSelect control the selected value determines which image to display.
HTML server controls