AJAX ModalPopup根据面板控件的更改更新面板内容

时间:2010-08-30 15:33:13

标签: asp.net ajax ajaxcontroltoolkit

我有一个AJAX模态弹出面板,其中包含一个RadioButtonList,2个标签和2个DropDowns。我想在选择单选按钮时更新标签和DropDowns。我在这个帖子的尝试回来导致ajax弹出消失。

aspx调用图片点击:

<asp:Panel ID="pnlModalContainer" runat="server">
    <asp:RadioButtonList ID="rblTest" runat="server" RepeatDirection="Horizontal" OnSelectedIndexChanged="rblTest_SelectedIndexChanged">
      <asp:ListItem Text="Test 1" Value="1" Selected="True" />
      <asp:ListItem Text="Test 2" Value="2" />
    </asp:RadioButtonList>
    <br />
    <asp:Label ID="lblFoo" Text="Foo" />
    <asp:Label ID="lblBar" Text="Bar" />
    <asp:DropDownList ID="ddlDogs" runat="server" DataSourceID="odsDogs" DataTextField="Dog" DataValueField="DogID" />
    <asp:DropDownList ID="ddlCats" runat="server" DataSourceID="odsCats" DataTextField="Cat" DataValueField="CatID" />
</asp:Panel>

Code Behind(vb.net):

Protected Sub rblTest_SelectedIndexChanged(ByVal sender As Object, ByVal e As EventArgs) Handles rblTest.SelectedIndexChanged
   ' ???
   ' Make it change lblFoo.Text and lblBar.Text as well as the DataSource for the DDLs
End Sub

1 个答案:

答案 0 :(得分:1)

您需要在pnlModalContainer中添加UpdatePanel。