<%@ Page Language="C#" %>

<script runat="server">
    protected void DropDownList1_SelectedIndexChanged(object sender, EventArgs e)
    {
         Response.Write("Wybrałeś element numer " +
           DropDownList1.SelectedValue + "<br>");
         Response.Write("Nie wybrałeś elementu numer " +
           DropDownList1.Items[1].Value);
    }
</script>

<html>
<head id="Head1" runat="server">
    <title>Kontrolka serwerowa DropDownList</title>
</head>
<body>
    <form id="form1" runat="server">
        <asp:DropDownList ID="DropDownList1" Runat="server" AutoPostBack="True" 
         OnSelectedIndexChanged="DropDownList1_SelectedIndexChanged">
            <asp:ListItem Value="1">Opcja pierwsza</asp:ListItem>
            <asp:ListItem Value="2" Enabled="False">Opcja druga</asp:ListItem>
            <asp:ListItem Value="3">Opcja trzecia</asp:ListItem>
        </asp:DropDownList>
    </form>
</body>
</html>
