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 »òÆäËûä¯ÀÀÆ÷¿ÉÖ±½ÓÖ§³ÖÎĵµ
Ïà¹ØÎĵµ£º
using System;
using System.Collections.Generic;
using System.Text;
using System.Security.Cryptography;namespace md5
{
class Program
{
static void Main(string[] args)
{
Console.WriteLine(UserMd5("8"));
Console.WriteLine(GetMd5Str("8"));
}
/**//// <summary>
/// MD5 16λ¼ÓÃÜ
......
1.//µ¯³ö¶Ô»°¿ò.µã»÷תÏòÖ¸¶¨Ò³Ãæ
Response.Write(" <script>window.alert('¸Ã»áԱûÓÐÌá½»ÉêÇë,ÇëÖØÐÂÌá½»£¡')
</script>");
Response.Write(" <script>window.location
='http://www.51aspx.com/bizpulic/upmeb.aspx' </script>");
2.//µ¯³ö¶Ô»°¿ ......
ASP.NETµ¯³ö¶Ô»°¿ò¼¸ÖÖ»ù±¾·½·¨
ASP.NETµ¯³ö¶Ô»°¿ò¼¸ÖÖ»ù±¾·½·¨
ÎÒÃÇÔÚ.NET³ÌÐòµÄ¿ª·¢¹ý³ÌÖУ¬³£³£ÐèÒªºÍÓû§½øÐÐÐÅÏ¢½»»¥£¬±ÈÈçÖ´ÐÐijÏî²Ù×÷ÊÇ·ñ³É¹¦£¬“È·¶¨”»¹ÊǓȡÏû”£¬ÒÔ¼°Ñ¡Ôñ“È·¶¨”»ò“È¡Ïû”ºóÊÇ·ñÐèÒªÌø×ªµ½Ä³¸öÒ³ÃæµÈ£¬ÏÂÃæÊÇ ......