繁体   English   中英

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

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

我通常使用

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);

在后面的代码中,向用户弹出一条消息,表明条目已成功保存。 但是我的问题是,在保存条目的同时我也正在下载文件的情况下,它不会显示在方案中。

我将条目保存在数据库中,然后根据保存的数据生成pdf文件并下载。 所有这些都只需单击一个按钮。 将条目保存在数据库中后,我想向用户显示弹出消息,然后问他是否要继续下载文件? 可能吗? 如果是,怎么办?

我不确定,但也许像这样的事情在下载过程中的某些函数中运行您的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