Torna al Thread
<%@ Page Language="C#" AutoEventWireup="true" %>
<script runat="server" >
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
string[] items = new string[] { "pippo", "pluto", "paperino", "mario" };
DropDownList1.DataSource = items;
DropDownList1.DataBind();
}
}
protected void selChanged(object sender, EventArgs e)
{
Response.Write("cliccato : " + (DropDownList1.SelectedValue as string));
}
</script>
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>Untitled Page</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:DropDownList ID="DropDownList1" runat="server"
OnSelectedIndexChanged="selChanged" AutoPostBack="true"
AppendDataBoundItems="true" >
<asp:ListItem Value=""></asp:ListItem>
</asp:DropDownList>
</div>
</form>
</body>
</html>