[Csharp]
Public override void VerifyRenderingInServerForm (Control control Control)
{}
Protected void LinkButton2_Click (object sender, EventArgs e)
{
Response. Clear ();
Response. Buffer = true;
Response. Charset = "gb2312 ";
Response. ContentEncoding = System. Text. Encoding. GetEncoding ("GB2312 ");
Response. appendHeader ("content-disposition", "attachment; filename = \" "+ System. web. httpUtility. urlEncode ("data export", System. text. encoding. UTF8) + ". xls \"");
Response. ContentType = "Application/ms-excel ";
System. IO. StringWriter oStringWriter = new System. IO. StringWriter ();
System. Web. UI. HtmlTextWriter oHtmlTextWriter = new System. Web. UI. HtmlTextWriter (oStringWriter );
This. Label1.RenderControl (oHtmlTextWriter );
This. GridView1.RenderControl (oHtmlTextWriter );
Response. Output. Write (oStringWriter. ToString ());
Response. Flush ();
Response. End ();
}