UpdatePanel 内的按钮会自动注册为该 UpdatePanel 的触发器。有没有办法让 UpdatePanel 忽略其中一个内部按钮?也就是说,要使单击此按钮不会触发任何类型的回发?
最佳答案
可以设置UpdateMode='Conditional'
然后在 <Triggers>
中设置要触发回发的按钮标签。像这样:
<asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="Conditional">
<Triggers>
<asp:PostBackTrigger ControlID="button1" />
</Triggers>
<ContentTemplate>
...
<asp:Button ID="button1" runat="server" Text="Click Me" />
</ContentTemplate>
</asp:UpdatePanel>
关于c# - 如何使 UpdatePanel 忽略单击其中的一个按钮?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2094579/