DropDownList 需要加AutoPostBack="true" ,OnSelectedIndexChanged方法才有效

时间:2022-09-19 00:01:27

<asp:DropDownList ID="ddlType" runat="server"  AutoPostBack="True"  OnSelectedIndexChanged="ddlType_SelectedIndexChanged">

    <asp:ListItem Value="0">---请选择---</asp:ListItem>

   <asp:ListItem Value="1">获得</asp:ListItem>

   <asp:ListItem Value="2">消费</asp:ListItem>

</asp:DropDownList>