The HtmlImage class defines the methods, properties, and events for the HtmlImage server control. This class provides programmatic access on the server to the HTML <img> element.
Object
Control
HtmlControl
HtmlImage
[Visual Basic] Public Class HtmlImage Inherits HtmlControl [C#] public class HtmlImage : HtmlControl [C++] public __gc class HtmlImage : public HtmlControl [JScript] public class HtmlImage extends HtmlControl
[To be supplied.]
Namespace: System.Web.UI.HtmlControls
Assembly: System.Web.dll
The following example demonstrates how developers can dynamically modify attributes on an HtmlImage control when the control is first loaded as a Web page.
[Visual Basic]
<html> <script language="VB" runat=server> Overrides Sub Load() ' Dynamically set image attributes on initial page load If (IsFirstLoad =true) Then MyImage.src = "myimage.jpg" MyImage.Width = "60%" MyImage.Height = "60%" End If End Sub </script> <body> <form method=post runat=server> Here is your picture: <img id="MyImage" runat=server/> </form> </body> </html>
HtmlImage Members | System.Web.UI.HtmlControls Namespace | HtmlContainerControl