易截截图软件、单文件、免安装、纯绿色、仅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/asp.net连接sql anywhere数据库


<%
set conn= server.createobject("ADODB.connection")
conn.open "driver={sybase driver 10};"
"srvr=SYBASE;"
"UID=sa;"
"pwd=sybase;"
sql="select no from tab_st ......

asp.net(C#) 数据库备份还原 源码

Backup.aspx
  protected void Button1_Click(object sender, EventArgs e)
    {
        string path = Server.MapPath("") + @"\Backup";
        if (!Directory.Exists(path))
       ......

asp.net常用技巧

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

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中,如何使用?
 
& ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号