<%@ Page Language="VB" %>
<%@ Import Namespace="System.Drawing" %>
<script runat="server">
sub NameHandler(Sender as Object, e as EventArgs)
lblMessage.Text = tbName.Text & ", select a color: "
end sub
sub ListHandler(Sender as Object, e as EventArgs)
lbColor.BackColor = Color.FromName(Sender.SelectedItem.Text)
end sub
</script>
<html><body>
<form runat="server">
<asp:Textbox id="tbName" runat="server"
OnTextChanged="NameHandler"
AutoPostBack="true" />
<asp:Label id="lblMessage" runat="server"
Text="Select a color: " />
<asp:Listbox id="lbColor" runat="server"
OnSelectedIndexChanged="ListHandler"
AutoPostBack="true" >
<asp:Listitem>Red</asp:Listitem>
<asp:Listitem>blue</asp:Listitem>
<asp:Listitem>green</asp:Listitem>
<asp:Listitem>white</asp:Listitem>
</asp:Listbox>
</form>
</body></html>