Answered by:
UpdateProgress not working for button which is in inside of trigger property

Question
-
User1140724383 posted
Hello guys,
This is my coding.
My issue is when i click the add button the update progress working well, but the
imgadd_Click
event don't work.The asp panel
pnmaili
remains visible.How to do resolve this?
Thanks in advance for any help, really appreciated.
<asp:UpdateProgress ID="UpdateProgress9" runat="server" AssociatedUpdatePanelID="UpdatePanel10"> <ProgressTemplate> <div class="modal"> <div class="center"> <img alt="" src="/aspnet/img/831.gif" /> </div> </div> </ProgressTemplate> </asp:UpdateProgress> <asp:UpdatePanel ID="UpdatePanel10" runat="server"> <ContentTemplate> <div class="container"> <asp:ImageButton ID="imgadd" runat="server" OnClick="imgadd_Click" ImageUrl="/aspnet/Img/add_button.gif" OnClientClick="if (!confirm('Confirm?')) return false;" /> </div> </ContentTemplate> <Triggers> <asp:AsyncPostBackTrigger ControlID="imgadd" /> </Triggers> </asp:UpdatePanel> protected void imgadd_Click(object sender, ImageClickEventArgs e) { Thread.Sleep(1000); pnmaili.Visible = false; }
Monday, April 13, 2020 2:01 PM
Answers
-
User288213138 posted
Hi mimidu,
mimidu
the postback it takes me back to the top of the page instead of staying where I call the eventIn the @page tag add MaintainScrollPositionOnPostback="true" .
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WebForm3.aspx.cs" Inherits="Thread.Test.WebForm3"
MaintainScrollPositionOnPostback="true" %>The result:
Best regards,
Sam
- Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
Tuesday, April 14, 2020 8:42 AM
All replies
-
User-18289217 posted
Where is the panel pnmaili? I think it should be inside the Update panel too in order to make it dissapear. e.g.
<asp:UpdatePanel ID="UpdatePanel10" runat="server"> <ContentTemplate> <div class="row"> <div class="col-xs-12"> <asp:ImageButton ID="imgadd" runat="server" OnClick="imgadd_Click" ImageUrl="/aspnet/Img/add_button.gif" OnClientClick="if (!confirm('Confirm?')) return false;" /> </div> </div> <asp:Panel runat="server" ID="pnmaili" CssClass="row" Visible="true"> <div class="col-xs-12"> pnmaili goes here </div> </asp:Panel> </ContentTemplate> <Triggers> <asp:AsyncPostBackTrigger ControlID="imgadd" /> </Triggers> </asp:UpdatePanel>
Now it will work
Monday, April 13, 2020 7:16 PM -
User288213138 posted
Hi mimidu,
<Triggers> <asp:AsyncPostBackTrigger ControlID="imgadd" /> </Triggers>
The AsyncPostBackTrigger defines a control and optional event of the control as an asynchronous postback control trigger that causes an UpdatePanel control to refresh.
You should use the PostBackTrigger. The PostBackTrigger defines a control inside a UpdatePanel control as a postback control.
<asp:PostBackTrigger ControlID="imgadd" />
Best regards,
Sam
Tuesday, April 14, 2020 2:09 AM -
User1140724383 posted
Hi Sam,
Thanks for reply.
Now working but the postback it takes me back to the top of the page instead of staying where I call the event
imgadd_Click
Tuesday, April 14, 2020 7:59 AM -
User288213138 posted
Hi mimidu,
mimidu
the postback it takes me back to the top of the page instead of staying where I call the eventIn the @page tag add MaintainScrollPositionOnPostback="true" .
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WebForm3.aspx.cs" Inherits="Thread.Test.WebForm3"
MaintainScrollPositionOnPostback="true" %>The result:
Best regards,
Sam
- Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
Tuesday, April 14, 2020 8:42 AM -
User1140724383 posted
Hi Sam,
Thank you so much for help, really appreciated.
Tuesday, April 14, 2020 9:14 AM