日期:2014-05-17  浏览次数:20422 次

window.showModalDialog()弹出的窗口 里面有下载链接 如何让这下载好用
  if (File.Exists(Server.MapPath(filePath)))
        {
            string strFileName = Path.GetFileName(filePath).Replace(" ", "%20");
            Response.ContentType = "application/octet-stream";
            Response.AddHeader("Content-Disposition", "attachment; filename=" + strFileName);
            Response.Clear();
            Response.WriteFile(Server.MapPath(filePath));
            Response.End();//到此行也不报错  ,就直接没反应了
        }


window.showModalDialog()弹出的窗口  里面有下载链接 如何让这下载好用???求帮忙!!!

------解决方案--------------------
用div 模拟showModalDialog
------解决方案--------------------
可以用超链接跳转到另一个页面,另一个页面就只有下载功能,将值传过去就行了
 <a href="页面.aspx?path=<%# Server.UrlEncode(Eval("path").ToString())%> "><%#Eval("path") %></a>

------解决方案--------------------
最好是用自己定义的窗体来做,可控性更高。
------解决方案--------------------

------解决方案--------------------
你直接在模态对话框中加一个a标签
<a id="hi" onclick="loadFile()">abc</a>

然后在js里面这样写

 function loadFile()
{
    window.location = "filepath";
}