开发者

Update ASP.NET page after Excel Export

开发者 https://www.devze.com 2023-01-06 17:38 出处:网络
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 contro

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

精彩评论

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