0

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

this is my code:

 <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" />

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

user3432519
  • 3
  • 1
  • 2
  • Any update on this problem you were having, please do not forgot to mark my answer if this helped you. – Seany84 Mar 18 '14 at 20:44

2 Answers2

1

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>

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

  1. If the Update method of the UpdatePanel control is called explicitly.
  2. If a control is defined as a trigger by using the Triggers property of the UpdatePanel control and causes a postback. In this scenario, the control is an explicit trigger for updating the panel content. The trigger control can be either inside or outside the UpdatePanel control that defines the trigger.
  3. If the ChildrenAsTriggers property is set to true and a child control of the UpdatePanel control causes a postback. In this scenario, child controls of the UpdatePanel control are implicit triggers for updating the panel. Child controls of nested UpdatePanel controls do not cause the outer UpdatePanel control to be updated unless they are explicitly defined as triggers.
Seany84
  • 5,526
  • 5
  • 42
  • 67
  • Are you updating the UpdatePanel from your `btnSaveImage_Click` method by any chance. The update panel should not be updating. – Seany84 Mar 18 '14 at 10:52
  • No. I just need the process of `btnSaveImage`. – user3432519 Mar 18 '14 at 10:54
  • I have tested the example I have given above and it does not refresh the panel when the button is clicked. In your application, is the update panel refreshing when the button is clicked after you added: `UpdateMode="Conditional"` ? – Seany84 Mar 18 '14 at 11:01
  • What if I have drag and drop icons to the stage (Dynamic Image). – user3432519 Mar 18 '14 at 11:13
  • I do not understand what you mean. Your question was originally: `Is it possible not to refresh the stage panel after clicking the btnSaveImage?` and this is what the answer has provided you with. – Seany84 Mar 18 '14 at 11:16
0

You can try this...

<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_B`enter code here`PO_ConnectedBPOClick-Startup_v1.1.png" CssClass="zClass" style="cursor:pointer"/>
           </asp:Panel>
      </ContentTemplate>
<Triggers>
<asp:AsyncPostBackTrigger ControlID="btnSaveImage" EventName="click"/>
</Triggers>
</asp:UpdatePanel>

Please feel free to mark as answer if the answer satisfies you....

Jameem
  • 1,840
  • 3
  • 15
  • 26