我在弹出的面板中有两个 dropDownLists。当我更改第一个 dropDownList 中的一个值时,我想用第一个 dropDownList 中选择的值填充第二个 dropDownList。就像我AutoPostBack = "true"
的页面总是令人耳目一新,弹出窗口消失了。事实上,我只想更新弹出窗口上的面板。
我正在使用AsyncPostBackTrigger
.
<asp:ModalPopupExtender ID="ModalPopupExtender1" runat="server" TargetControlID="btnShowPopup"
PopupControlID="pnlpopup" CancelControlID="btnCancel" BackgroundCssClass="modalBackground">
</asp:ModalPopupExtender>
<asp:Panel ID="pnlpopup" runat="server" BackColor="White" Height="199px" Width="400px"
Style="display: none">
<table width="100%" style="border: Solid 3px #D55500; width: 100%; height: 100%"
cellpadding="5" cellspacing="0">
<tr style="background-color: #D55500">
<td colspan="2" style="height: 10%; color: White; font-weight: bold; font-size: larger"
align="center">
Insert Product
</td>
</tr>
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate>
<tr>
<td align="right" style="width: 45%">
Category:
</td>
<td>
<asp:DropDownList AutoPostBack="true" runat="server" ID="DropDownList1" OnSelectedIndexChanged="dropDownList_Change" />
</td>
</tr>
<tr>
<td align="right">
Product:
</td>
<td>
<asp:DropDownList id="DropDownList2" runat="server">
</asp:DropDownList>
</td>
</tr>
</ContentTemplate>
<Triggers>
<asp:AsyncPostBackTrigger ControlID="DropDownList1" EventName="SelectedIndexChanged" />
</Triggers>
</asp:UpdatePanel>
<tr>
<td>
</td>
<td>
<asp:Label ID="popup_modo" runat="server" Visible="false"></asp:Label>
<asp:Button ID="btnCommand" CommandName="Update" runat="server" Text="Update" OnClick="btnUpdate_Click" />
<asp:Button ID="btnCancel" runat="server" Text="Cancel" />
</td>
</tr>
</table>
</asp:Panel>