如果是单个gridview使用一下代码可以导出到excel
            Response.Clear();
            Response.Buffer = true;
            Response.Charset = "GB2312";
            Response.AppendHeader("Content-Disposition", "attachment;filename=kq.xls");
            Response.ContentType = "application/excel";
            EnableViewState = false;
            StringWriter swOut = new StringWriter();
            HtmlTextWriter hTw = new HtmlTextWriter(swOut);
            gvwData.RenderControl(hTw);
            Response.Write(swOut.ToString());
            ApplicationInstance.CompleteRequest();
            Response.Flush();
            Response.End();
如果嵌套了gridview则不能导出到excel,请各大能指教!