AlternateText: alternate text for the image required for accessibility.
DescriptionUrl: a link to a page that contains a detailed description of the image (required to make a complex image accessible).
GenerateEmptyAlternateText: set the AlternateText property to an empty string.
ImageAlign: align the image relative to other HTML elements in the page. Possible values are AbsBottom, AbsMiddle, Baseline, Bottom, Left, Middle, NotSet, Right, TextTop, and Top.
ImageUrl: specify the URL to the image.
<%@ Page Language="C#" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<script runat="server">
void Page_Load()
{
Random rnd = new Random();
switch (rnd.Next(3))
{
case 0:
imgRandom.ImageUrl = "Picture1.gif";
imgRandom.AlternateText = "Picture 1";
break;
case 1:
imgRandom.ImageUrl = "Picture2.gif";
imgRandom.AlternateText = "Picture 2";
break;
case 2:
imgRandom.ImageUrl = "Picture3.gif";
imgRandom.AlternateText = "Picture 3";
break;
}
}
</script>
<html xmlns="http://www.w3.org/1999/xhtml" >
<head id="Head1" runat="server">
<title>Show Image</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:Image
id="imgRandom"
Runat="server" />
</div>
</form>
</body>
</html>
|