ASP.Net 2.0 Image control provides the functionality to display images on ASP.Net web page. The image server control renders using HTML img tag in the web browser. As a web server control it can be accessed at server side that enables you to set the images dynamically using C# code or by specifying the image URL retrieved from SQL database table.
It provides properties similar to HTML img tag that allow you to set the path of image file that you want to display on web page along with its alignment and alternate text properties that render as attributes of HTML img tag in the web browser. You can get or set these properties at design time as well as using C# code programmatically.
The ASP.Net image control allows you to display the images only for design purposes or as a part of the page content but does not support any server events to execute the server side code if a user clicks on it or moves the mouse over it.
|AlternateText||You can specify the text value for this property that appears as tooltip for the displayed image in the web browsers. All web browsers do not support this property to display the text as tooltip. The web browsers display this alternate text value if the specified image does not load for any reason like unreachable or unavailable at that time. This property renders as alt attribute of img tag.|
|DescriptionUrl||You can specify the URL of the web page containing the full description regarding the image.|
|GenerateEmptyAlternateText||It is a Boolean type property that allows or disallows to generate the empty alt attribute while rendering the image control.|
|ImageAlign||It enables you to specify the alignment of image as a part of inline content or web page elements.|
|ImageUrl||You can specify the URL of the image that you want to display on the web page.|
|ToolTip||It enables you to specify the tooltip text for the image control. The tooltip property generates the title attribute of img tag that appears as tooltip in some browsers.|
Apart from these properties there some other CSS based properties that enable you to set the border, background color, height and width of the image. The CSS based properties include: BackColor, BorderColor, BorderStyle, BorderWidth, CssClass, Height and Width that allow you to customize the appearance of image.
<asp:Image ID="Image1" runat="server" Height="215px" ImageUrl="~/Images/Sunset.jpg" />