Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/batch-file/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript ASP.NET响应。写入iframe完成_Javascript_Asp.net_Iframe - Fatal编程技术网

Javascript ASP.NET响应。写入iframe完成

Javascript ASP.NET响应。写入iframe完成,javascript,asp.net,iframe,Javascript,Asp.net,Iframe,我正在ASP.NET中开发一个应用程序,用于创建报告并将其下载到客户端。我使用发布到服务器的iframe来完成这项工作。操作完成后,使用Response.Write()将报告下载到客户端 同时,在客户机上,我显示了一个GIF,表示服务器正在生成报告。当报表成功创建并完成对客户端的写入后,我想相应地更新iframe,并隐藏GIF 是否有任何方法可以确定response.write()在iframe的父页面中是否成功 家长: <iframe id="iframe1" src="import-u

我正在ASP.NET中开发一个应用程序,用于创建报告并将其下载到客户端。我使用发布到服务器的iframe来完成这项工作。操作完成后,使用Response.Write()将报告下载到客户端

同时,在客户机上,我显示了一个GIF,表示服务器正在生成报告。当报表成功创建并完成对客户端的写入后,我想相应地更新iframe,并隐藏GIF

是否有任何方法可以确定response.write()在iframe的父页面中是否成功

家长:

<iframe id="iframe1" src="import-upload.html" width="100%" height="300" onload="loadFrame()" frameborder="0">

function redirect(type) {
        iframe.getElementById('inputType').value = list.options[list.selectedIndex].value;
        iframe.getElementById('inputAction').value = type;

        document.getElementById("divOptionsContainer").style.display = "none";
        document.getElementById("imgLoadingGif").style.display = "";

        iframe.getElementById('frmUpload').submit();
    }

函数重定向(类型){
iframe.getElementById('inputType')。值=列表。选项[list.selectedIndex]。值;
iframe.getElementById('inputAction')。值=类型;
document.getElementById(“divoptionContainer”).style.display=“无”;
document.getElementById(“imgLoadingGif”).style.display=“”;
iframe.getElementById('frmUpload').submit();
}
Iframe源:

<div align="center">
    <form id="frmUpload" action="AjaxFileHandler.aspx" method="POST" enctype="multipart/form-data" target="_self" style="margin-bottom:20px;">
        <input id="fileupload" type="file" name="files[]" />
        <input type="hidden" id="inputAction" name="action"/>
        <input type="hidden" id="inputType" name="type"/>
    </form>

    <button id="btnReport" type="button" onclick="parent.redirect('Report')" style="">Report</button>
    <button id="btnUpload" type="button" onclick="parent.redirect('Import')" style="">Import</button>
</div>

汇报
进口

这是我的第一篇文章。如果需要更多信息,请告诉我。提前感谢。

您可以收听iframe的
onload
事件:

function redirect(type) {
    iframe.getElementById('inputType').value = list.options[list.selectedIndex].value;
    iframe.getElementById('inputAction').value = type;

    document.getElementById("divOptionsContainer").style.display = "none";
    document.getElementById("imgLoadingGif").style.display = "";

    iframe.onload = function() {
        document.getElementById("divOptionsContainer").style.display = "";
        document.getElementById("imgLoadingGif").style.display = "none";
    }

    iframe.getElementById('frmUpload').submit();
}

这对重定向很有效,但对response.write()似乎不起作用。您可以从post请求中发布响应头吗?您可以从Chrome开发工具的“网络”选项卡复制它们。