【发布时间】:2014-06-20 19:20:16
【问题描述】:
我一直在围绕我只想更新的对象将UpdatePanels 添加到我的应用程序中。
示例,当我单击按钮时,我希望更新 ListBox。我会将UpdatePanel 包裹在 html 中的列表框周围,但是当我这样做时,我的设计会到处都是。
我不确定我是否以正确的方式使用 AJAX,因为我看到有人添加 Triggers 但不知道如何以及在何处使用它们,这是我的代码示例:
<asp:ListBox ID="lst_AdminExistingDepartments" runat="server" >
<asp:ListItem Text="Acceptance"></asp:ListItem>
<asp:ListItem Text="Acceptance"></asp:ListItem>
<asp:ListItem Text="Acceptance"></asp:ListItem>
<asp:ListItem Text="Acceptance"></asp:ListItem>
<asp:ListItem Text="Acceptance"></asp:ListItem>
<asp:ListItem Text="Acceptance"></asp:ListItem>
<asp:ListItem Text="Acceptance"></asp:ListItem>
</asp:ListBox>
</div>
<div class="AddEditUpdateDepartment">
<asp:Label ID="lbl_AdminAddEditUpdateDepartments" runat="server" Text="Modify Departments" />
<asp:Label ID="lbl_AdminAddDepartment" runat="server" Text="Add Department" />
<input id="txt_AddDepartment" runat="server" type="text" class="aclass" />
<input id="btn_AddDepartment" runat="server" type="button" class="ButtonAdminPage" value="Add" onserverclick="btn_AddDepartment_ServerClick" />
这里有一个ListBox,还有一个Textbox 和一个Button。当他们单击 Button 时,我希望 ListBox 使用 AJAX 使用在 TextBox 中输入的记录进行更新?
【问题讨论】: