Mega Code Archive

 
Categories / ASP.Net Tutorial / ASP Net Controls
 

Load Image to asp

<%@ Page Language="VB" AutoEventWireup="false" CodeFile="Default.aspx.vb"  Inherits="_Default" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" > <head runat="server">     <title>Untitled Page</title> </head> <body>     <form id="form1" runat="server">     <div>         <div>             <asp:Label ID="Label1" runat="server" Height="32px" Text="Image to display" Width="176px"></asp:Label>             <asp:DropDownList ID="DropDownList1" runat="server" AutoPostBack="True" Width="112px">                 <asp:ListItem>A</asp:ListItem>                 <asp:ListItem>B</asp:ListItem>             </asp:DropDownList>             <div>                 <asp:Button ID="Button1" runat="server" Text="Select Image" /></div>         </div>         <div>             <asp:Image ID="Image1"                         runat="server"                         AlternateText="Image"                         Height="128px"                         ToolTip="Image"                        Width="208px" /></div>          </div>     </form> </body> </html> File: Default.aspx.vb Partial Class _Default     Inherits System.Web.UI.Page     Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click         Select Case DropDownList1.SelectedIndex             Case 0                 Image1.ImageUrl = "http://www.rntsoft.com/style/logo.png"             Case 1                 Image1.ImageUrl = "http://www.rntsoft.com/style/logo.png"         End Select     End Sub End Class