簡體   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