</asp:DropDownList>
代码如下
<form id="form1" runat="server">
<div>
<asp:DropDownList ID="DropDownList1" runat="server" AutoPostBack="True"
onselectedindexchanged="DropDownList1_SelectedIndexChanged">
<asp:ListItem>boy</asp:ListItem>
<asp:ListItem>girl</asp:ListItem>
</asp:DropDownList>
</div>
</form>
后台
protected void MyDropDownListSex_SelectedIndexChanged(object sender, EventArgs e)
{
Response.Write(boy);
Response.Write(girl);
}
我要选择girl就打印girl 选择BOY就打印BOY