<%@ Page Language="c#" %>
<script runat="server">
void Page_Load()
{
if(Page.IsPostBack)
lblMessage.Text = "You have selected " + DropList1.SelectedItem.Value;
}
</script>
<html>
<head>
</head>
<body>
<form runat="server">
<asp:DropDownList ID="DropList1" runat="server">
<asp:listitem>apple</asp:listitem>
<asp:listitem>banana</asp:listitem>
<asp:listitem>carrot</asp:listitem>
<asp:listitem>durian</asp:listitem>
</asp:DropDownList><br/>
<asp:Button runat="server" Text="Button"></asp:Button><br/>
<asp:Label ID="lblMessage" runat="server"/>
</form>
</body>
</html>
|