HttpContext.Current.Response.Clear();
HttpContext.Current.Response.Buffer= true;
HttpContext.Current.Response.Charset="GB2312";
HttpContext.Current.Response.AppendHeader("Content-Disposition","attachment;filename=RFSMainInquiryResult.xls");
HttpContext.Current.Response.ContentEncoding=System.Text.Encoding.GetEncoding("GB2312");//扢离怀堤霜峈潠极笢恅
HttpContext.Current.Response.ContentType = "application/ms-excel";//扢离怀堤恅璃濬倰峈excel恅璃﹝
DatagridApproval.EnableViewState = false;
System.Globalization.CultureInfo myCItrad = new System.Globalization.CultureInfo("ZH-CN",true);
System.IO.StringWriter oStringWriter = new System.IO.StringWriter(myCItrad);
System.Web.UI.HtmlTextWriter oHtmlTextWriter = new System.Web.UI.HtmlTextWriter(oStringWriter);
DatagridApproval.RenderControl(oHtmlTextWriter);
HttpContext.Current.Response.Write(oStringWriter.ToString());
HttpContext.Current.Response.End(); -----------------------
上面是我的代碼,問題是我的datagrid是分几頁顯示的,用上面的代碼只導出當前看的那一頁
HttpContext.Current.Response.Buffer= true;
HttpContext.Current.Response.Charset="GB2312";
HttpContext.Current.Response.AppendHeader("Content-Disposition","attachment;filename=RFSMainInquiryResult.xls");
HttpContext.Current.Response.ContentEncoding=System.Text.Encoding.GetEncoding("GB2312");//扢离怀堤霜峈潠极笢恅
HttpContext.Current.Response.ContentType = "application/ms-excel";//扢离怀堤恅璃濬倰峈excel恅璃﹝
DatagridApproval.EnableViewState = false;
System.Globalization.CultureInfo myCItrad = new System.Globalization.CultureInfo("ZH-CN",true);
System.IO.StringWriter oStringWriter = new System.IO.StringWriter(myCItrad);
System.Web.UI.HtmlTextWriter oHtmlTextWriter = new System.Web.UI.HtmlTextWriter(oStringWriter);
DatagridApproval.RenderControl(oHtmlTextWriter);
HttpContext.Current.Response.Write(oStringWriter.ToString());
HttpContext.Current.Response.End(); -----------------------
上面是我的代碼,問題是我的datagrid是分几頁顯示的,用上面的代碼只導出當前看的那一頁
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货