<html>
<head>
<script language="VB" Runat="server">
Sub Page_Load(Source as Object, E as EventArgs)
	if not Page.IsPostBack then
		LoadDDL
	end if
End Sub

Sub LoadDDL()
	ddl.Items.Clear
	ddl.Items.Add("")
	ddl.Items.Add("Red")
	ddl.Items.Add("Green")
	ddl.Items.Add("Blue")
	ddl.Items.Add("Other")
End Sub

Sub doChoice(Source as Object, E as EventArgs)
	if ddl.selecteditem.text="Other" then
		label1.visible="true"
		txtOther.visible="true"
	else
		label1.visible="false"
		txtOther.visible="false"
	End If 
End Sub

Sub GetChoice(Source as Object, E as EventArgs)
	if txtOther.visible="true" and txtOther.text <>"" then
		lblResults.text="You chose " & txtOther.text & _
			" -- from the text box"
	else
		lblResults.text="You chose " & _
		ddl.selectedItem.text & " - - from the DropDownList"
	End If 
	LoadDDL
	txtOther.text=""	
End Sub
</script>
	<meta name="GENERATOR" Content="ASP Express 3.1">
	<title>Adding and Using an 'Other' Selection in a DropDownList</title>
</head>
<body>
<form id="form1" Runat="server">
<asp:DropDownList id="ddl" 
	AutoPostBack="True" 
	OnSelectedIndexChanged="doChoice" 
		Runat="Server">
	</asp:DropDownList>
<asp:Label ID="label1" Visible="False" 
	Text="Other: " Runat="server" /> 
<asp:TextBox id="txtOther" 
	Visible="False" 
	Runat="server" />
<asp:Button id="button1" 
	Text="Get Choice" 
	onclick="getChoice" Runat="server" />
<p>
<asp:Label ID="lblResults" Runat="server" />
</form>
</body>
</html>
