c# - UpdateProgress not appearing on second click of same button -
updateprogress appear first time, when click on button btnsubmit. when click same button next time updateprogress not appearing. other things works well. using updateprogress show gif image while sending e-mail client. first client updateprogress appear second other 'n' updateprogress not appearing. please asking question second time in stack overflow
code below shows updateprogress
<asp:updatepanel id="up1" runat="server"> <contenttemplate> <asp:updateprogress id="updprogress" runat="server"> <progresstemplate> <div class="modal"> <div class="center"> <span style="padding-left: 10px"><b>please wait..</b></span> <img alt="" src="../images/preloader_3.gif" width="50" height="50" /> </div> </div> </progresstemplate> </asp:updateprogress> </contenttemplate> <triggers> <asp:asyncpostbacktrigger controlid="btnsubmit" eventname="click" /> </triggers> </asp:updatepanel>
code below shows button trigger updateprogress
<asp:updatepanel id="updatepanel1" runat="server"> <triggers> <asp:asyncpostbacktrigger controlid="btnsubmit" eventname="click" /> </triggers> <contenttemplate> <div class="form-group row"> <div class="col-sm-6"> <div class="col-sm-6"> <asp:button id="btnsubmit" onclick="btnsubmit_click" onclientclick="javascript:return btnsubmit();" cssclass="btn btn-primary" runat="server" text="submit" /> <a href="assignment.aspx?sid=<%=request.querystring["sid"] %>" class="btn btn-default">cancel</a> </div> </div> </div> </contenttemplate> </asp:updatepanel>
code behind cs
protected void btnsubmit_click(object sender, eventargs e) { updprogress.visible = true; sendemail(convert.toint32(drpdiv.text)); updprogress.visible = false; }
you have place update progress outside update panel , associate update progress. can create update panel trigger button auto post true.
<asp:updateprogress id="updateprogress1" runat="server" associatedupdatepanelid="updatepanel1"> <progresstemplate> <!-- place message here --> </progresstemplate> </asp:updateprogress> <asp:updatepanel id="updatepanel1" runat="server"> <contenttemplate> <asp:button id="btnsubmit" onclick="btnsubmit_click" runat="server" autopostback="true" /> </contenttemplate> </asp:updatepanel> <asp:updatepanel id="updatepanel2" runat="server"> <contenttemplate> <!-- can put controls here --> </contenttemplate> <triggers> <asp:asyncpostbacktrigger controlid="btnsubmit" eventname="click" /> </triggers> </asp:updatepanel>
or, second method is:
<asp:updateprogress id="updateprogress1" runat="server" associatedupdatepanelid="updatepanel1"> <progresstemplate> <!-- place message here --> </progresstemplate> </asp:updateprogress> <asp:updatepanel id="updatepanel1" runat="server"> <contenttemplate> <asp:button id="btnsubmit" onclick="btnsubmit_click" runat="server" autopostback="true" /> </contenttemplate> <triggers> <asp:asyncpostbacktrigger controlid="btnsubmit" eventname="click" /> </triggers> </asp:updatepanel>
Comments
Post a Comment