如何显示“保存”对话框

时间:2013-03-27 16:55:40

标签: c# asp.net syncfusion

您好我想在我的asp.net网页中显示一个保存文件对话框,用户点击一个按钮,出现一个保存文件对话框,允许用户将图表保存在他的硬盘中,我该怎么办? / p>

用于在服务器上保存图表,我使用

string AppPath = Server.MapPath(string.Empty);
DiagramWebControl1.SaveBinary(AppPath + @"\Test.edd");

1 个答案:

答案 0 :(得分:1)

你应该在回发按钮事件上做这样的事情:

     string filepath = AppPath + @"\Test.edd";
     HttpContext.Current.Response.ContentType = "application/octet-stream";
     HttpContext.Current.Response.AddHeader("Content-Disposition",
              "attachment; filename=" + "Test.edd");
     HttpContext.Current.Response.Clear();
     HttpContext.Current.Response.WriteFile(filepath);
     HttpContext.Current.Response.End();
相关问题