当前位置:编程学习 > C#/ASP.NET >>

没有保存到,对话框就突然消失不见了。。。

同上,
我用C#代码编写了一个网页图表下载的代码,不晓得为什么,没有保存到,对话框就突然消失不见了。。。
请高手帮帮忙
谢谢  --------------------编程问答-------------------- 贴出代码看看 --------------------编程问答-------------------- string style = @"<style> .text { mso-number-format:\@; } </script> ";
        Response.Clear();
        Response.Buffer = true;

        Response.AppendHeader("Content-Disposition", "attachment;filename=JiHua.xls");
        Response.ContentEncoding = System.Text.Encoding.GetEncoding("gb2312");

        Response.ContentType = "application/ms-excel";
        this.EnableViewState = false;

        System.Globalization.CultureInfo myCItrad = new System.Globalization.CultureInfo("ZH-CN", true);

        System.IO.StringWriter oStringWriter = new System.IO.StringWriter

        (myCItrad);
        System.Web.UI.HtmlTextWriter oHtmlTextWriter = new System.Web.UI.HtmlTextWriter(oStringWriter);
        Panel1.Visible = true;

        Panel1.RenderControl(oHtmlTextWriter);

        Response.Charset = "gb2312";
        Response.Write(style);
        Response.Write(oStringWriter.ToString());
        Panel1.Visible = false;
        Response.End(); --------------------编程问答-------------------- 高手啊!!!!到哪里去啦
--------------------编程问答--------------------
你网页图表的内容在那里输出的??
我怎么没看到。。。 --------------------编程问答-------------------- Response.End();
先注释掉 --------------------编程问答-------------------- Panel1.RenderControl(oHtmlTextWriter);
在Panel1控件中输出表的

--------------------编程问答-------------------- 代码应该没什么问题
Response.Clear();     
  Response.Buffer=   true;   
  Response.Charset="UTF-8";   
  Response.AppendHeader("Content-Disposition","attachment;filename=FileName.xls");   
  Response.ContentEncoding=System.Text.Encoding.GetEncoding("UTF-8");   
  Response.ContentType   =   "application/ms-excel";   
  System.Globalization.CultureInfo   myCItrad   =   new   System.Globalization.CultureInfo("ZH-cn",true);   
  System.IO.StringWriter   oStringWriter   =   new   System.IO.StringWriter(myCItrad);   
  System.Web.UI.HtmlTextWriter   oHtmlTextWriter   =   new   System.Web.UI.HtmlTextWriter(oStringWriter);   
    
  this.EnableViewState   =   false;   
  this.panel1.RenderControl(oHtmlTextWriter);   
    
  Response.Write(oStringWriter.ToString());   
  Response.End();   
--------------------编程问答-------------------- 我也觉得
就是有的电脑能出来 或者有时候能出来 有时候出不来
不晓得是迅雷问题还是IE的问题 --------------------编程问答-------------------- @"<style> .text { mso-number-format:\@; } </script> ";

sytle?script?
补充:.NET技术 ,  ASP.NET
CopyRight © 2012 站长网 编程知识问答 www.zzzyk.com All Rights Reserved
部份技术文章来自网络,