ASP.NET: Image Album
Notes:

Web Page

<%@ Page Language="C#" Inherits="Album" src="Album.aspx.cs" %>
<html>
<head>
<title>Photo Album</title>
</head>
<body>
<form method="post" Runat="server">
<asp:DropDownList ID="list" AutoPostBack="true"
OnSelectedIndexChanged="Show" Runat="server">

<asp:ListItem Text="Albrecht" Value="Albrecht.jpg"/>
<asp:ListItem Text="Didi" Value="Didi.jpg"/>
<asp:ListItem Text="Peter" Value="Peter.jpg"/>
<asp:ListItem Text="Wolfgang" Value="Wolfgang.jpg"/>
</asp:DropDownList>
<br><br>
<asp:Image ID="img" ImageUrl="Albrecht.jpg" Runat="server"/>
</form>
</body>
</html>
 

Code Behind

using System;
using System.Web.UI;
using System.Web.UI.WebControls;

public class Album : Page {
protected DropDownList list;
protected Image img;

public void Show(object sender, EventArgs e) {
img.ImageUrl = list.SelectedItem.Value;
}
}

 

 

 

No votes yet
Related Links:ASP.NET: Displaying HTTP Request ParametersASP.NET: User ControlsASP.NET: Validity ChecksASP.NET: Validity ChecksASP.NET: Page Counter
© Copyright 2008. All Rights Reserved.