如何使用更新面板上的按钮单击asp [英] How to use update panel on button click asp

查看:60
本文介绍了如何使用更新面板上的按钮单击asp的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在创建一个.ASP应用程序,它将图像拖放到舞台上.

I am creating an .ASP application that will drag and drop image to the stage.

这是我的代码:

 <asp:UpdatePanel ID="UpdatePanel3" runat="server">
          <ContentTemplate> 
               <asp:Panel ID="stage" runat="server" cssClass="containment-wrapper" style="border:1px solid #000000;" data-ajax="false">
                        <asp:Image ID="imgBrowse" runat="server" Height="376px" Width="640px" ImageUrl="Image/IC_BPO_ConnectedBPOClick-Startup_v1.1.png" CssClass="zClass" style="cursor:pointer"/>
               </asp:Panel>
          </ContentTemplate>
  </asp:UpdatePanel>
  <asp:Button ID="btnSaveImage" runat="server" Text="Button" OnClick="btnSaveImage_Click" />

是否可以在单击 btnSaveImage 后不刷新舞台面板?

Is it possible not to refresh the stage panel after clicking the btnSaveImage?

推荐答案

您可以将UpdatePanel的 UpdateMode 设置为

You can set the UpdateMode of the UpdatePanel to Conditional

<asp:UpdatePanel ID="UpdatePanel3" runat="server" UpdateMode="Conditional">
      <ContentTemplate> 
           <asp:Panel ID="stage" runat="server" cssClass="containment-wrapper" style="border:1px solid #000000;" data-ajax="false">
                    <asp:Image ID="imgBrowse" runat="server" Height="376px" Width="640px" ImageUrl="Image/IC_BPO_ConnectedBPOClick-Startup_v1.1.png" CssClass="zClass" style="cursor:pointer"/>
           </asp:Panel>
      </ContentTemplate>
  </asp:UpdatePanel>

要更新UpdatePanel,可以通过以下方式之一对其进行更新:

To update the UpdatePanel, you can update it via one of the following ways:

  1. 如果显式调用UpdatePanel控件的Update方法.
  2. 如果使用UpdatePanel控件的Triggers属性将控件定义为触发器,则导致回发.在这种情况下,该控件是用于更新面板内容的显式触发器.触发器控件可以在定义触发器的UpdatePanel控件内部或外部.
  3. 如果ChildrenAsTriggers属性设置为true,并且UpdatePanel控件的子控件导致回发.在这种情况下,UpdatePanel控件的子控件是用于更新面板的隐式触发器.嵌套的UpdatePanel控件的子控件不会导致外部UpdatePanel控件被更新,除非将它们明确定义为触发器.

这篇关于如何使用更新面板上的按钮单击asp的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆