当用户点击“导出到 Excel”链接时,标准的“文件下载”对话框会呈现给用户。有关示例图像,请参见此处。
但在导出 excel 文件之前,我想显示一个警报弹出窗口。但是“保存”对话框遮挡了警报弹出窗口的视图。
如何在不被遮挡的情况下显示弹出窗口?
这是我的代码...
dsResult = clsObj.getSearchResults_BL(detObj);
if (OrdDifference != null && OrdDifference.Any())
{
ScriptManager.RegisterClientScriptBlock(this.up, this.GetType(), "export", "alert('.....')", true);
set(dsResult, strName);
}
else
{
set(dsResult, strName);
}
private void set(DataSet ds, string strFileName)
{
ExcelEngine excelEngine = new ExcelEngine();
IApplication application = excelEngine.Excel;
application.DefaultVersion = ExcelVersion.Excel2007;
IWorkbook workbook = application.Workbooks.Create(1);
IWorksheet sheet = workbook.Worksheets[0];
try
{
sheet.Name = strFileName;
sheet.ImportDataTable(ds.Tables[0], true, 1, 1, -1, -1);
...
workbook.SaveAs(strFileName, ExcelSaveType.SaveAsXLS, HttpContext.Current.Response, ExcelDownloadType.PromptDialog);
}
catch (Exception ex)
{
}
}