<head>
<title>Static ListBox Example</title>
<link rel="stylesheet" href="/shared/netdemos.css">
<script language="C#" runat="server">
void Page_Load ( object src, EventArgs e ) {
if ( myList.SelectedIndex > -1 ) {
msg.Text = "Destination " + myList.SelectedItem.Text;
Image.ImageUrl = "~/shared/images/" + myList.SelectedItem.Value;
Image.AlternateText = myList.SelectedItem.Text;
}
}
</script>
</head>
<body>
<!-- #include virtual="~/shared/top.inc -->
<div class="header"><h2>Static ListBox Example</h2></div>
<!-- #include virtual="~/shared/viewsrc_top.inc" -->
<hr size=1 width=92%>
<div align="center">
<form runat="server">
<asp:ListBox id="myList" width=100 runat="server">
<asp:listitem selected value="earth.gif" text="Earth"/>
<asp:listitem value="jupiter.gif" text="Jupiter"/>
<asp:listitem value="mars.gif" text="Mars"/>
<asp:listitem value="mercury.gif" text="Mercury"/>
<asp:listitem value="neptune.gif" text="Neptune"/>
<asp:listitem value="pluto.gif" text="Pluto"/>
<asp:listitem value="saturn.gif" text="Saturn"/>
<asp:listitem value="uranus.gif" text="Uranus"/>
<asp:listitem value="venus.gif" text="Venus"/>
</asp:ListBox>
<asp:button Text="Submit" runat="server" />
<p><asp:Label id="msg" runat="server" />
<p><asp:Image id="Image" runat="server" />
</form>
</div>
<hr size=1 width=92%>
<!-- #include virtual="~/shared/viewsrc.inc" -->
</body>
</html>