UpdatePanel AsyncPostbackTrigger未触发

时间:2015-06-15 09:59:25

标签: asp.net ajax webforms updatepanel

我有一点问题,感谢任何帮助。

情况如下:

<asp:UpdatePanel ID="UP_Panel" runat="server" UpdateMode="Conditional">
    <ContentTemplate>
        <asp:DropDownList ID="ddlSwitch" runat="server" Width="250px" AutoPostback="true"
            OnSelectedIndexChanged="ddlSwitch_SelectedIndexChanged">

            <asp:ListItem Value="continent" Text="Continent"></asp:ListItem>
            <asp:ListItem Value="region" Text="Region"></asp:ListItem>
            <asp:ListItem Value="country" Text="Country"></asp:ListItem>

        </asp:DropDownList>

        <asp:UpdatePanel ID="UP_Switch" runat="server" UpdateMode="Conditional">
            <ContentTemplate>
                // Some content
            </ContentTemplate>
            <Triggers>
                <asp:AsyncPostBackTrigger ControlID="ddlSwitch" EventName="SelectedIndexChanged" />
            </Triggers>
        </asp:UpdatePanel>
    </ContentTemplate>
</asp:UpdatePanel>

ddlSwitch 选择索引更改时,我想更新 UP_Switch 中的内容,但SelectedIndexChanged事件似乎没有触发。我做错了什么?

提前致谢!

1 个答案:

答案 0 :(得分:1)

我刚刚测试了您的代码,似乎正在进行一些测试修改:ASPX

  <ion-popover-view>
    <ion-header-bar>
      <h1 class="title">My Popover Title</h1>
    </ion-header-bar>
<ion-content><ul class="list" ng-repeat="item in a">
<li class="item item-checkbox"><label class="checkbox">
<input type="checkbox" ></label>{{item.name}}</li>
</ul>
</ion-content>
  </ion-popover-view>

<asp:UpdatePanel ID="UP_Panel" runat="server" UpdateMode="Conditional"> <ContentTemplate> <asp:DropDownList ID="ddlSwitch" runat="server" Width="250px" AutoPostback="true" OnSelectedIndexChanged="ddlSwitch_SelectedIndexChanged"> <asp:ListItem Value="continent" Text="Continent"></asp:ListItem> <asp:ListItem Value="region" Text="Region"></asp:ListItem> <asp:ListItem Value="country" Text="Country"></asp:ListItem> </asp:DropDownList> <asp:UpdatePanel ID="UP_Switch" runat="server" UpdateMode="Conditional"> <ContentTemplate> <asp:Literal ID="litUpSwitch" runat="server"></asp:Literal> </ContentTemplate> <Triggers> <asp:AsyncPostBackTrigger ControlID="ddlSwitch" EventName="SelectedIndexChanged" /> </Triggers> </asp:UpdatePanel> </ContentTemplate> </asp:UpdatePanel> 后面的代码:

ddlSwitch_SelectedIndexChanged

结果: