简体   繁体   English

更新面板的 asyncpostbacktrigger 是否可以有两个控件 ID?

[英]Can the asyncpostbacktrigger of an update panel have two control IDs?

I have a button outside an update panel which controls an update panel very well.我在更新面板外有一个按钮,可以很好地控制更新面板。 I also want another button to update this same update panel when the click event is triggered.当点击事件被触发时,我还想要另一个按钮来更新这个相同的更新面板。 How can I achieve this?我怎样才能做到这一点?

You can have multiple triggers registered to a single update panel.您可以将多个触发器注册到单个更新面板。 Something like the following should work:像下面这样的东西应该工作:

<asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="Conditional">
  <ContentTemplate>
  </ContentTemplate>
  <Triggers>
    <asp:AsyncPostBackTrigger ControlID="Button1" EventName="Click" />
    <asp:AsyncPostBackTrigger ControlID="Button2" EventName="Click" />
  </Triggers>
</asp:UpdatePanel>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM