<html>
<head>
<title>HtmlSelect Control Example</title>
<link rel="stylesheet" href="/shared/netdemos.css">
<style type="text/css">
<!--
#msg {padding:10}
-->
</style>
<script language="C#" runat="server">
void applyColor ( object src, EventArgs e ) {
msg.Style [ "background-color" ] = colorSelect.Value;
}
void addToList ( object src, EventArgs e ) {
if ( Text1.Value !="" ) {
colorSelect.Items.Add ( Text1.Value );
}
}
</script>
</head>
<body>
<!-- #include virtual="~/shared/top.inc -->
<div class="header"><h2><span class="hilite">HtmlSelect Control</span> Example</h2></div>
<!-- #include virtual="~/shared/viewsrc_top.inc" -->
<hr size=1 width=92%>
<div align="center">
<form runat="server">
<p id="msg" runat="server">Click the button to apply a background color to this span.</p>
<p>Select a color: <select id="colorSelect" runat="server">
<option>Aqua</option>
<option>Bisque</option>
<option>Chartreuse</option>
<option>DodgerBlue</option>
<option>ForestGreen</option>
<option>Gainsboro</option>
<option>HotPink</option>
<option>Ivory</option>
<option>Khaki</option>
<option>Lavender</option>
<option>Magenta</option>
<option>NavajoWhite</option>
<option>Olive</option>
<option>PaleGoldenRod</option>
<option>Red</option>
<option>SandyBrown</option>
<option>Tan</option>
<option>Violet</option>
<option>Wheat</option>
<option>YellowGreen</option>
</select>
<input type=button runat="server" Value="Apply"
onServerClick="applyColor"></p>
<p>Don’t see your color in the list above? You can add it below: </p>
<input type=text id="Text1" runat="server">
<input type=button runat="server" Value="Add to List"
onServerClick="addToList">
</form>
</div>
<hr size=1 width=92%>
<!-- #include virtual="~/shared/viewsrc.inc" -->
</body>
</html>