- The Image control is used to display an image.
| Property | Description |
| AlternateText | An alternate text for the image |
| Enabled | Specifies whether this control is enabled |
| Font | Specifies the font for the alternate text |
| id | A unique id for the control |
| ImageAlign | Specifies the alignment of the image. Legal values are:
- NotSet
- AbsBottom
- AbsMiddle
- BaseLine
- Bottom
- Left
- Middle
- Right
- TextTop
- Top
|
| ImageUrl | The URL of the image to display for the link |
| runat | Specifies that the control is a server control. Must be set to "server" |
Download the following image:
http://www.morosko.com/comics1.gif
save it to the c:\inetpub\wwwroot directory
| 1 | <html> |
| 2 | <body> |
| 3 | <form runat="server"> |
| 4 | <asp:Image runat="server" AlternateText="Ad" ImageUrl=" comics1.gif " /> |
| 5 | </form> |
| 6 | </body> |
| 7 | </html> |
| Try this in Visual Studio: |
- Open Visual Studio
- Add a new webform
- Name it ImageEx.aspx
- Add an Image control
- In the properties window change the AlternateText property to Ad
- Add an existing item and select the comics1.gif file
- Select the image control again
- Click on the ellipsis in the imageURL property
- Add the Comics1.gif image file
- Test it