【发布时间】:2009-01-06 16:11:46
【问题描述】:
我有一个包含两个 ContentPlaceHolder 的页面。一个有一个 DropDown 和另一个带有内容的 UpdatePanel。
当 DropDown 的 selectedItemChanged 事件在不同的 ContentPlaceholders 中时,如何触发对 UpdatePanel 的更新?
由于 UpdatePanel1 不知道 DropDown1,因此以下操作无效:
<asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="Conditional" ChildrenAsTriggers="true">
<ContentTemplate>
Some content that needs to be updated here...
</ContentTemplate>
<Triggers>
<asp:AsyncPostBackTrigger ControlID="DropDown1" EventName="SelectedIndexChanged" />
</Triggers>
</asp:UpdatePanel>
One way is to make an ajax page method that would be called by javascript on the page when DropDown's item is selected.然后在后面的代码中,在该页面方法中,调用 UpdatePanel1.Update()。
有没有更简单的选择?
【问题讨论】:
标签: asp.net ajax updatepanel