Ò׽ؽØÍ¼Èí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

asp.net½«Ò³ÃæÖÐgridviewÖеÄÊý¾Ýµ¼Èëexcel±íÖÐ

using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.IO;
namespace AJAXEnabledWebApplication1
{
public partial class excelOutput : System.Web.UI.Page
{
DBClass db = new DBClass();
protected void Page_Load(object sender, EventArgs e)
{
if (!Page.IsPostBack)
{
string strsql = "select * from TreeViewTemp where parentID=0";
DataTable dt = db.GetDataTable(strsql);
this.GridView1.DataSource = dt;
this.GridView1.DataBind();
}
}
protected void Button1_Click(object sender, EventArgs e)
{

OutPutExcel();
}
//´Ë´¦Òª×¢Òâ,Õâ¸öÖØÔØ·½·¨,Ò»¶¨ÒªÐ´,²»È»»á±¨ÀàÐÍ“GridView”µÄ¿Ø¼þ“GridView1”±ØÐë·ÅÔÚ¾ßÓÐ runat=server µÄ´°Ìå±ê¼ÇÄÚ
public override void VerifyRenderingInServerForm(Control control)
{
}
public void OutPutExcel()
{
//¶¨ÒåÎĵµÀàÐÍ¡¢×Ö·û±àÂë
Response.Clear();
Response.Buffer = true;
Response.Charset = "GB2312";
//ÏÂÃæÕâÐкÜÖØÒª£¬ attachment ²ÎÊý±íʾ×÷Ϊ¸½¼þÏÂÔØ£¬Äú¿ÉÒÔ¸Ä³É onlineÔÚÏß´ò¿ª
//filename=FileFlow.xls Ö¸¶¨Êä³öÎļþµÄÃû³Æ£¬×¢ÒâÆäÀ©Õ¹ÃûºÍÖ¸¶¨ÎļþÀàÐÍÏà·û£¬¿ÉÒÔΪ£º.doc ¡¡¡¡ .xls ¡¡¡¡ .txt ¡¡¡¡.htm
Response.AppendHeader("Content-Disposition", "attachment;filename=FileFlow.xls");
Response.ContentEncoding = System.Text.Encoding.GetEncoding("GB2312");
//Response.ContentTypeÖ¸¶¨ÎļþÀàÐÍ ¿ÉÒÔΪapplication/ms-excel¡¢application/ms-word¡¢application/ms-txt¡¢application/ms-html »òÆäËûä¯ÀÀÆ÷¿ÉÖ±½ÓÖ§³ÖÎĵµ


Ïà¹ØÎĵµ£º

Mix 10 ÉϵÄasp.net mvc 2µÄÏà¹ØSession

Beyond File | New Company: from Cheesy Sample to Social Platform Scott Hanselman in Lagoon L on Monday at 11:30 AM The web has changed and there's a new way of thinking about your applications. You can't just write some HTML and CSS anymore and expect to be the next Twitter. Hear h ......

ASPתASP.NET£¨1£©

      ÓëASPÏà±È£¬ASP.NETÔÚºÜ¶à·½ÃæÓÐÁËÏÔÖøµÄ¸Ä½ø£¬ÕâЩ·½Ãæ°üÀ¨£ºÐÔÄÜ¡¢×´Ì¬¹ÜÀí¡¢¿ÉËõ·ÅÐÔ¡¢ÅäÖᢲ¿Êð¡¢°²È«ÐÔ¡¢Êä³ö»º´æ¿ØÖÆ¡¢ÍøÂ糡֧³ÖºÍXML Web services½á¹¹µÈ¡£   
      Èç¹ûÄú¾ßÓÐASP   ¿ª·¢¼¼ÄÜ£¬ÔòÐ嵀   ASP.NET   ±à³Ì ......

ASP.NETÖÐ×Ö·û´®½øÐÐMD5¼ÓÃÜ

×î½üÔÚ¿´¡¶asp.netͨÓÃÄ£¿é¼°µäÐÍϵͳ¿ª·¢ÊµÀýµ¼º½¡·£¬ÆäÖÐÓõ½ÁËMD5¼ÓÃÜ£¬´úÂëÈçÏ£º /// <summary>
/// ×Ö·û´®¼ÓÃܺ¯Êý
/// </summary>
/// <param name="strInput">ÊäÈë±»¼ÓÃܵÄ×Ö·û´®</param>
/// <returns>¼ÓÃܺóµÄ×Ö·û´®</return ......

·ÖÏíÎÒµÄһЩASP.NET SEO¾­Ñé

[url=http://www.bvbuy.cn/]·çÓïÍø[/url]
1.Ç°Ì¨Ò³ÃæÒ»°ã²»ÓÃgridview datalist treeview updatepanel µÈ¿Ø¼þ£¬ÒòΪËûÃÇ»áÉú³ÉºÜ¶àÎÒ²»ÏëÒªµÄ´úÂë¡£¶øÇÒǶÌ×Ò»´ó¶Ñtable
2.ÓÃrepeater+div+css+ul liÒѾ­×ã¹»ÎÒ×öºÜ¶à¶«Î÷ÁË¡£
3.·¢²¼ºóµÄÒ³Ãæ£¬¿ÉÒÔ°ÑһЩ¿ÕÐкͻ»ÐÐ ºÍһЩ²»±ØÒªµÄ¿Õ¸ñÈ¥µô£¬¾¡Á¿¼õÉÙaspxÒ³ÃæµÄÈÝÁ¿¡£ÌḠ......

Asp.NET³£Óú¯Êý

Ucase(string) ½«×Ö·û´®×ª»»Îª´óд¡£
Val(string) ½«´ú±íÊý×ÖµÄ×Ö·û´®×ª»»ÎªÊýÖµÐÍ̬£¬Èô×Ö·û´®Öк¬ÓзÇÊý×ÖµÄÄÚÈÝÔò»á½«ÆäÈ¥³ýºó£¬ºÏ²¢ÎªÒ»Êý×Ö¡£
Weekday(date) È¡µÄ²ÎÊýÖеÄÈÕÆÚÊÇÒ»¸öÐÇÆÚµÄµÚ¼¸Ì죬ÐÇÆÚÌìΪ1¡¢ÐÇÆÚһΪ2¡¢ÐÇÆÚ¶þΪ3 ÒÀ´ËÀàÍÆ¡£
WeekDayName(number) ÒÀ½ÓÊյIJÎÊýÈ¡µÃÐÇÆÚµÄÃû³Æ£¬¿É½ÓÊյIJÎÊýΪ1 µ½ ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØÍ¼ | ¸ÓICP±¸09004571ºÅ