Set ImageUrl and AlternateText for asp:Image (VB.net) : Image « ASP.net Controls « ASP.NET Tutorial






<%@ Page Language="VB" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<script runat="server">

    Sub Page_Load()
        Dim rnd As New Random()
        Select Case rnd.Next(3)
            Case 0
                imgRandom.ImageUrl = "Picture1.gif"
                imgRandom.AlternateText = "Picture 1"
            Case 1
                imgRandom.ImageUrl = "Picture2.gif"
                imgRandom.AlternateText = "Picture 2"
            Case 2
                imgRandom.ImageUrl = "Picture3.gif"
                imgRandom.AlternateText = "Picture 3"
        End Select
    End Sub
    
</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>








3.7.Image
3.7.1.Important properties of Image control
3.7.2.Load Image to asp:Image
3.7.3.Set ImageUrl and AlternateText for asp:Image (VB.net)
3.7.4.Image alignment