开发者

Update ASP.NET page after Excel Export

I'm using Response.Write, Response.End to export to Excel/Word/csv. Is 开发者_JAVA百科there a way to do this and also be able to change text on the page at the same time? For example, I have a controls within an UpdatePanel which I want to make visible/invisible.


Update your page via the AJAX action and, in the process, write out some javascript that calls a separate page/handler that does the actual export.

 if (exporting)
 {
     string cacheID = Guid.NewGuid().ToString();
     Session[cacheID] = ...data or query to export...
     ScriptManager.RegisterStartupScript(Page,
             Page.GetType(),
             cacheid,
             "window.location = '/download.ashx?cacheid=" + cacheID + "';",
             True);
 }
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜