易截截图软件、单文件、免安装、纯绿色、仅160KB

asp.net导出成EXCEL

以下是导出的方法:
public static void ToExcel(System.Web.UI.Control ctl)
    {
        //HttpContext.Current.Response.Charset   ="GB2312";  
        HttpContext.Current.Response.Charset = "GBK";
        HttpContext.Current.Response.AppendHeader("Content-Disposition", "attachment;filename=memory.xls");
        HttpContext.Current.Response.ContentEncoding = System.Text.Encoding.GetEncoding("GBK");
        HttpContext.Current.Response.ContentType = "application/ms-excel";//image/JPEG;text/HTML;image/GIF;vnd.ms-excel/msword  
       
        ctl.Page.EnableViewState = false;
       
        System.IO.StringWriter tw = new System.IO.StringWriter();
        System.Web.UI.HtmlTextWriter hw = new System.Web.UI.HtmlTextWriter(tw);
       
        ctl.RenderControl(hw);
       
        HttpContext.Current.Response.Write(tw.ToString());
        HttpContext.Current.Response.End();
    }
在其它方法中调用:ToExcel(gridview1);


相关文档:

ZZ使用SQL Server存储ASP.NET Session变量

创建和配置ASP.NET Session状态数据库
在基于NLB(网络负载平衡)环境下的ASP.NET Web应用程序开发,我们需要将Session存储在数据库中供多个Web应用程序调用,以下为配置方法及注意事项。
1.创建用于存储ASP.NET Session的数据库(远程、本地皆可,使用数据库用户身份认证)
在Windows\Microsoft.NET\Framework/V2.0.507 ......

解决asp.net页面插入数据时权限不足问题

static void Main(string[] args)
  {
  string connstr = "Data Source=***;user=system;password=***;";
  OracleConnection conn = new OracleConnection(connstr);
  conn.Open();
  string orclstr="insert into SYS.A_MODULE values('03','查看生产任务','查看生产任务进度')";
  ......

Cookie应用完全解析(一):asp.net中Cookie技术

Cookie 是什么?
 
在asp.net中,如何使用?
 
 
 
1   Cookie 是什么?
 
Cookie:电脑中记录用户在网络中的行为的文件;网站可通过Cookie来识别用户是否曾经访问过该网站。(摘自 http://gb.cri.cn/17004/2007/03/08/121@1487554.htm)
2在asp.net中,如何使用?
 
& ......

asp.net模态窗口每次进入不刷新问题

模态窗口每次页面重新打开不刷新。
缓存的原因,改成这样:
解决办法。。。
url   =   frmWin   +   "? "   +   Math.random();
window.showModalDialog(url,me, 'dialogWidth= '+width   + 'px;dialogHeight= '+height+ 'px;help:no;status:no;resizable:no;scro   ll:no; ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号