当我使用DropDownList1_SelectedIndexChanged作为UpDatePanel的触发器时,它不起作用

时间:2013-05-15 01:58:09

标签: c# asp.net drop-down-menu updatepanel

提示是“DropDownList1”未找到“DropDownList1_SelectedIndexChanged”

</asp:ScriptManager>

<asp:UpdatePanel ID="UpdatePanel1" runat="server">

   <ContentTemplate>

    <asp:DropDownList ID="DropDownList1" runat="server" 

        onselectedindexchanged="DropDownList1_SelectedIndexChanged">

        <asp:ListItem>1</asp:ListItem>

    </asp:DropDownList>

   </ContentTemplate>

        <Triggers>

            <asp:AsyncPostBackTrigger ControlID="DropDownList1" EventName="DropDownList1_SelectedIndexChanged" /> 

        </Triggers>

请告诉我如何使它工作!

1 个答案:

答案 0 :(得分:2)

您需要AutoPostBack=True

<asp:DropDownList ID="DropDownList1" runat="server"  AutoPostBack="True"   
        onselectedindexchanged="DropDownList1_SelectedIndexChanged">