Image Class
Assembly: System.Web (in system.web.dll)
Use the Image control to display an image on the Web page. The path to the displayed image is specified by setting the ImageUrl property. You can specify the text to display in place of image when the image is not available by setting the AlternateText property. The alignment of the image in relation to other elements on the Web page is specified by setting ImageAlign property.
Note |
|---|
| This control only displays an image. If you need to capture mouse clicks on the image, use the ImageButton control. |
Accessibility
The markup rendered by default for this control might not conform to accessibility standards such as the Web Content Accessibility Guidelines 1.0 (WCAG) priority 1 guidelines. For details about accessibility support for this control, see ASP.NET Controls and Accessibility.
| Topic | Location |
|---|---|
| How to: Add Image Web Server Controls to a Web Forms Page | Building ASP .NET Web Applications |
| How to: Add Image Web Server Controls to a Web Forms Page | Building ASP .NET Web Applications |
| Walkthrough: Creating and Using ASP.NET Master Pages in Visual Web Developer | Building ASP .NET Web Applications in Visual Studio |
| Walkthrough: Creating an Accessible Web Application | Building ASP .NET Web Applications in Visual Studio |
| How to: Add Image Web Server Controls to a Web Forms Page (Visual Studio) | Building ASP .NET Web Applications in Visual Studio |
The following example demonstrates how to create an Image control on a Web page.
Note |
|---|
| The following code sample uses the single-file code model and may not work correctly if copied directly into a code-behind file. This code sample must be copied into an empty text file that has an .aspx extension. For more information on the Web Forms code model, see ASP.NET Web Page Code Model. |
- AspNetHostingPermission for operating in a hosted environment. Demand value: LinkDemand. Permission value: Minimal.
- AspNetHostingPermission for operating in a hosted environment. Demand value: InheritanceDemand. Permission value: Minimal.
System.Web.UI.Control
System.Web.UI.WebControls.WebControl
System.Web.UI.WebControls.Image
System.Web.UI.WebControls.ImageButton
System.Web.UI.WebControls.ImageMap
Windows 98, Windows 2000 SP4, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
The .NET Framework does not support all versions of every platform. For a list of the supported versions, see System Requirements.
Note