如何下载文件并重新加载 [英] How to download file and reload

查看:142
本文介绍了如何下载文件并重新加载的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有包含执行以下code按钮的网页,我想响应末尾,以便更新在网页网格后重新加载页面。或暗示的方式响应结束后更新网格

I have a page which contains a button that perform the following code, I want to reload the page after the response end so that update a grid in that page. or suggest a way to update the grid after response end.

string report = new BLL.OrderReport.OrderReport().GenerateFullfilmentReport(fromdate, toDate
            , string.IsNullOrEmpty(generationId)? null : ((int?)int.Parse(generationId)) );

        if (!string.IsNullOrEmpty(report))
        {


            LoadReportHistory();

            Response.ContentType = "text/plain";
            Response.AppendHeader("Content-Disposition", "attachment; filename=Report.text");
            Response.Write(report);
            Response.End();
        }

感谢

推荐答案

我解决这个问题,这个问题是我需要到Response.End被称为后要重新绑定网格。

I work around this, the problem is that I need the Grid to be rebind after Response.End is called.

目标正在更新时,用户点击下载网格。上班这一点我第一次重新绑定网格,并注册一个Java Script code会导致重新加载页面(回发事件将会被重新发送)

The target is updating the Grid when user click download. To work this out I rebind the grid first, and register a java script code to cause reloading the page (post back event will be resent),

在第二轮我下载的文件。

in the second round I download the file.

我控制这个小姐通过将原始文件复制到临时文件,然后第一轮中删除临时文件,如果文件存在,然后下载。

I control this miss by copying the original file to temp file, then delete the temp file during first round, if the file exist then download.

有人告诉我更好的东西请

Someone tell me something better please

这篇关于如何下载文件并重新加载的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆