Kamis, 18 Juli 2013

How to use ImageControl in ASP.NET

Related Post



Introduction 
The Image control is standard Web Server control, which is used to display an image on a Web page. This control exists within the System.Web.UI.WebControl namespace. You set the Uniform resource Locator (URL) of the image with the ImageUrl property of the Image control. The alignment of the image in relation to other elements on the Web page is specified by setting the ImageAlign property.

Public properties of the image Class
AlternateText : Obtains or sets the alternate text displayed in the image control when the image is not available . Browsers that support the ToolTips featurs display this text as a tooltip.
DescriptionUrl : Obtains or sets the location to a detailed description for the image.
Enabled : Obtains or sets a value indicating whether the control is enabled.
Font : Obtains or sets the font properties for the text associated with the control.
GenerateEmptyAlternateText : Obtains or sets a value indicating whether the control generates an alternate text attribute for an empty string value.
ImageAlign : Obtains or sets the alignment of the image control in relation to other controls on the Web page.

ImageUrl : Obtains or sets the location of an image to where it display in the Image control.

Example of Image control in asp.net

First insert image in any folder or root folder of the website

ImageControl example in asp.net

<%@ Page Language="C#" %>

<!DOCTYPE html>

<script runat="server">

</script>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <asp:Image ID="Image1" runat="server" ImageUrl ="~/Img/images.jpg" />
    </div>
    </form>
</body>
</html>

Tidak ada komentar:

Posting Komentar