Changing the ImageUrl property dynamically (VB) : Image « Asp Control « ASP.Net






Changing the ImageUrl property dynamically (VB)

<%@ Page Language="VB" %>

<script runat="server">
   Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs)
        Image1.ImageUrl = "~/MyImage2.gif"
   End Sub
</script>

<html xmlns="http://www.w3.org/1999/xhtml" >
<head id="Head1" runat="server">
    <title>Image control</title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <asp:Image ID="Image1" Runat="server" ImageUrl="~/MyImage1.gif" /><br />
        <br />
        <asp:Button ID="Button1" Runat="server" Text="Change Image" 
         OnClick="Button1_Click" />
    </div>
    </form>
</body>
</html>

 








Related examples in the same category

1.asp:image: change image dynamically
2.Changing the ImageUrl property dynamically (C#)