1 Response.Clear();
Response.Clear();
2 Response.AddHeader("content-disposition", "attachment;filename=FileName.doc");
   Response.AddHeader("content-disposition", "attachment;filename=FileName.doc");
3 Response.Charset = "";
   Response.Charset = "";
4 Response.Cache.SetCacheability(HttpCacheability.NoCache);
   Response.Cache.SetCacheability(HttpCacheability.NoCache);
5 Response.ContentType = "application/vnd.word";
   Response.ContentType = "application/vnd.word";
6 this.EnableViewState = false;
   this.EnableViewState = false;
7 System.IO.StringWriter stringWrite = new System.IO.StringWriter();
   System.IO.StringWriter stringWrite = new System.IO.StringWriter();
8 
            
9 System.Web.UI.HtmlTextWriter htmlWrite = new HtmlTextWriter(stringWrite);
   System.Web.UI.HtmlTextWriter htmlWrite = new HtmlTextWriter(stringWrite);
10 int nCur = myDataGrid.CurrentPageIndex;
   int nCur = myDataGrid.CurrentPageIndex;
11 int nSize = myDataGrid.PageSize;
   int nSize = myDataGrid.PageSize;
12 myDataGrid.AllowPaging = false;
   myDataGrid.AllowPaging = false;
13 DGBind();//数据绑定
   DGBind();//数据绑定
14 myDataGrid.RenderControl(htmlWrite);
   myDataGrid.RenderControl(htmlWrite);
15 myDataGrid.AllowPaging = true;
   myDataGrid.AllowPaging = true;
16 myDataGrid.CurrentPageIndex = nCur;
   myDataGrid.CurrentPageIndex = nCur;
17 myDataGrid.PageSize = nSize;
   myDataGrid.PageSize = nSize;
18 DGBind();
   DGBind();
19 Response.Write(stringWrite.ToString());
   Response.Write(stringWrite.ToString());
20 Response.End();
   Response.End();
 Response.Clear();
Response.Clear();2
 Response.AddHeader("content-disposition", "attachment;filename=FileName.doc");
   Response.AddHeader("content-disposition", "attachment;filename=FileName.doc");3
 Response.Charset = "";
   Response.Charset = "";4
 Response.Cache.SetCacheability(HttpCacheability.NoCache);
   Response.Cache.SetCacheability(HttpCacheability.NoCache);5
 Response.ContentType = "application/vnd.word";
   Response.ContentType = "application/vnd.word";6
 this.EnableViewState = false;
   this.EnableViewState = false;7
 System.IO.StringWriter stringWrite = new System.IO.StringWriter();
   System.IO.StringWriter stringWrite = new System.IO.StringWriter();8
 
            9
 System.Web.UI.HtmlTextWriter htmlWrite = new HtmlTextWriter(stringWrite);
   System.Web.UI.HtmlTextWriter htmlWrite = new HtmlTextWriter(stringWrite);10
 int nCur = myDataGrid.CurrentPageIndex;
   int nCur = myDataGrid.CurrentPageIndex;11
 int nSize = myDataGrid.PageSize;
   int nSize = myDataGrid.PageSize;12
 myDataGrid.AllowPaging = false;
   myDataGrid.AllowPaging = false;13
 DGBind();//数据绑定
   DGBind();//数据绑定14
 myDataGrid.RenderControl(htmlWrite);
   myDataGrid.RenderControl(htmlWrite);15
 myDataGrid.AllowPaging = true;
   myDataGrid.AllowPaging = true;16
 myDataGrid.CurrentPageIndex = nCur;
   myDataGrid.CurrentPageIndex = nCur;17
 myDataGrid.PageSize = nSize;
   myDataGrid.PageSize = nSize;18
 DGBind();
   DGBind();19
 Response.Write(stringWrite.ToString());
   Response.Write(stringWrite.ToString());20
 Response.End();
   Response.End(); 
                     
                    
                 
                    
                 
 
                
            
         
         浙公网安备 33010602011771号
浙公网安备 33010602011771号