【问题标题】:when I use the DropDownList1_SelectedIndexChanged to be the trigger of UpDatePanel,it dosn't work当我使用 DropDownList1_SelectedIndexChanged 作为 UpDatePanel 的触发器时,它不起作用
【发布时间】:2013-05-15 01:58:09
【问题描述】:

提示是“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>

请告诉我如何使它工作!

【问题讨论】:

  • 不确定 Asp 世界,但在其他框架中,您指定事件名称,而不是事件处理程序名称,试试 EventName="SelectedIndexChanged" 看看它是否有效
  • 因为您的更新面板模式不是有条件的,您只需要像@Scott Selby 所说的那样添加 AutoPostBack=True

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


【解决方案1】:

你需要AutoPostBack=True

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

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-03-27
    • 1970-01-01
    • 2023-04-05
    • 2014-08-03
    • 2021-04-04
    相关资源
    最近更新 更多