简体   繁体   English

是否有可能在特定时间点停止执行代码并要求确认然后继续进行?

[英]Is it possible to stop execution of code behind at certain point and ask for confirmation and then proceed?

I usually use 我通常使用

ScriptManager.RegisterStartupScript(this, this.GetType(), "pop", "<script>alert('Claim Saved Successfully with Claim No: " + ClaimNo + "');var currentPageUrl =document.location.toString().toLowerCase();window.location.assign(currentPageUrl);</script>", false);

in code behind to pop up a message to the user that the entry has been saved successfully. 在后面的代码中,向用户弹出一条消息,表明条目已成功保存。 But my problem with this is that it does not show in a scenario when along with saving the entry I am also downloading a file. 但是我的问题是,在保存条目的同时我也正在下载文件的情况下,它不会显示在方案中。

I save an entry in the database and then generate a pdf file from the saved data and download it. 我将条目保存在数据库中,然后根据保存的数据生成pdf文件并下载。 All this on a single button click. 所有这些都只需单击一个按钮。 I want to show a pop up message to the user after the entry has been saved in the database and then ask him if he wants to proceed and download the file? 将条目保存在数据库中后,我想向用户显示弹出消息,然后问他是否要继续下载文件? Is it possible? 可能吗? If yes how? 如果是,怎么办?

i am not sure but maybe something like this run your 20 line of code in some function befor the download process then run some thing like this 我不确定,但也许像这样的事情在下载过程中的某些函数中运行您的20行代码,然后运行类似的东西

     ScriptManager.RegisterStartupScript(page,this.GetType(), "temp","javascript:Confirmopen();
",true);

function Confirmopen()    
{    
    if (confirm(" Download  file ?"))    
    {   
        enter code here 
        call server side function for download
    }
    else   
    {   
        return false;
    }    
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM