易截截图软件、单文件、免安装、纯绿色、仅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);


相关文档:

ASP.NET网站开发小结

1.<script src="Scripts/AC_RunActiveContent.js" type="text/javascript"></script>
Vs2005红色了,提示找不到该文件
于是改为.<script src="/Scripts/AC_RunActiveContent.js" type="text/javascript"></script>
结果红色没有了,但是编译时报错,找不到该文件
结论:<script src="Script ......

解决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','查看生产任务','查看生产任务进度')";
  ......

微软企业库5.0学习笔记(九)ASP.NET WEB应用程序

在ASP.NET Web窗体应用程序中,推荐的方法是将容器存到由Application字典对象提供的全局状态。当需要的时候你可以访问容器,甚至使用HTTP模块自动完成对页面上控件的注入。
通常情况下,你应该使用Application字典对象来存储容器的单个实例。您可能决定创建主要容器的子容器,并将它们存储到每个用户的Session对象中,甚至 ......

ASP.NET程序中常用的三十三种代码

1. 打开新的窗口并传送参数:
  传送参数:
response.write("<script>window.open(’*.aspx?id="+this.DropDownList1.SelectIndex+"&id1="+...+"’)</script>")
  接收参数:
string a = Request.QueryString("id");
string b = Request.QueryString("id1");
  2.为按钮添加对话框
Button1 ......

asp.net GridView的一些应用

应用1:GridView和CheckBox结合
效果图:
应用2:Extending the GridView Control
Code download available at: CuttingEdge05.exe (132 KB)
Browse the Code Online
 Contents
The GridView Difference
A New GridView Control
Adding a Checkbox Column
The New Grid In Action
Styling Selected ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号