模式对话框 打开文件

第一步:我在页面A.asp 弹出模式对话框B.asp

 

  function Show() {           

   xposition = (screen.width - 800) / 2;

   yposition = (screen.height - 420) / 2;

   window.showModalDialog("B.aspx?Rnd=" + Math.random(), "LogDetail", "dialogHeight:550px; dialogWidth:670px;');window.location.href=window.location.href;");

   return false;

  }

 

第二步:然后B.asp转到C.aspx服务器端按钮触发。

 Response.Redirect("C.aspx?rnd="+Guid.NewGuid());

然后在C.aspx里点一个按钮打开一个excle,发现打开不了。

第三步:

   

 System.Web.HttpResponse httpresponse = Response;

                httpresponse.HeaderEncoding = System.Text.Encoding.GetEncoding("gb2312");

                httpresponse.Charset = "GB2312";

                IELang.DownloadFile(this.Page, Path.GetFileName(strWrongPath), strWrongPath);

 

解决方式。

第二步改成如下:

Response.Redirect("D.aspx?rnd="+Guid.NewGuid());

D.apsx代码如下

<frameset rows="550,*,*" cols="670" frameborder="no" border="0" framespacing="0">



    <frame name="Content" id="Content" src="C.aspx?rnd=math.random()" scrolling="auto" frameborder="NO" border="0" framespacing="0" ></frame> </frameset>

 

这样就可以了。别忘记C里加上 <base target="_self"/>

你可能感兴趣的:(打开文件)