Quantcast
Channel: ASP.NET AJAX + Ajax Control Toolkit (ACT)
Viewing all articles
Browse latest Browse all 5678

Modal Popup won't close

$
0
0

Hello

I have been trying to add modal popup extender in order to show loading message while the report is loading. The report is actually rendered in pdf (so once the user clicks on print button - code redirects to the different aspx where report is created - it shows as a pop up message to open/save report as pdf). I'm attaching modal popup to the print button click. It works - pop up message shows up, but I am unable to close it. So modal popup is on default page, report is generated on a separate page, but shows as pop up window. I would like loading message showing till the report pop up shows up to save it as pdf. Tried to add closing popup code even prior to redirecting to the report page - doesn't work. What would be a proper way to close it?

<script>
function showPopup() {
		    var modalPopupBehavior = $find('programmaticModalPopupBehavior');
		    modalPopupBehavior.show();
		}
		function hidepopup() {
		    var modalPopupBehavior = $find('programmaticModalPopupBehavior');
		    modalPopupBehavior.hide();
		}</script><asp:UpdatePanel ID="UpdPopModal" runat="server"><ContentTemplate><asp:Button runat="server" ID="hiddenTargetControlForModalPopup" style="display:none"/><ajaxToolkit:ModalPopupExtender runat="server" ID="programmaticModalPopup"
            BehaviorID="programmaticModalPopupBehavior"
            TargetControlID="hiddenTargetControlForModalPopup"
            PopupControlID="programmaticPopup"
            BackgroundCssClass="modalBackground"
            DropShadow="True"
            RepositionMode="RepositionOnWindowScroll" DynamicServicePath="" ></ajaxToolkit:ModalPopupExtender><asp:Panel runat="server" CssClass="modalPopup" ID="programmaticPopup" style="background-color:lightblue;display:none;height:25px;width:85px;padding:10px"><div id='messagediv' style="text-align:center">Loading...</div><div id="hiddencancel" style="display:none"><asp:Button ID="btnCancel" runat="server" Text="Close Me" OnClientClick="hidepopup()"/> </div></asp:Panel></ContentTemplate></asp:UpdatePanel>
...<asp:Button ID="btnPrint" runat="server" OnClick="btnPrint_Click" OnClientClick="showPopup()" Text="Print/PDF" />

in cs:

 protected void btnPrint_Click(object sender, EventArgs e)
        {
...
 ClientScript.RegisterStartupScript(this.GetType(), "CallMyFunction", "hidepopup()", true);
            programmaticModalPopup.Hide();

            Response.Redirect("ReportsPage.aspx");
    }


Viewing all articles
Browse latest Browse all 5678

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>