请问如何将DATAGRID中的全部数据全部生成至EXCEL文件中? 你的数据源不要用MyDataGrid数据源用datagrid的数据源就可以了 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 Dim numbercols As Integer = MyDataGrid.Items.Item(0).Cells.Count取的只是当前页的items数。用DataSet.yourTable.Rows.Count public void ToExcel(System.Web.UI.Control ctl) { HttpContext.Current.Response.AppendHeader("Content-Disposition","attachment;filename=Excel.txt"); HttpContext.Current.Response.Charset = "gb2312"; HttpContext.Current.Response.ContentEncoding = System.Text.Encoding.Default; HttpContext.Current.Response.ContentType = "application/ms-excel";//image/JPEG;text/HTML;image/GIF;vnd.ms-excel/msword // HttpContext.Current.Response.ContentType ="application/Microsoft Excel"; // ctl.Page.EnableViewState = false; System.IO.StringWriter tw = new System.IO.StringWriter(); System.Web.UI.HtmlTextWriter hw = new System.Web.UI.HtmlTextWriter(tw); ctl.RenderControl(hw); HttpContext.Current.Response.Write(tw.ToString()); HttpContext.Current.Response.End(); ctl.Visible = false; } showmodaldialog 事件不响应 少见的问题 关于Cookie垮域访问的问题 小试了一个网站,改的是别人的源码.效果不错. 请问定位跳转是怎么实现的 母版页不能用无刷回调功能? 上传图片的问题!!解决就给分 DetailView 如何增加空白行?? 发布的网站,查询功能,带某一个字段的时候报错, 怎样处理IsPostBack,急,在线等 菜鸟提问:page_load与button_click的参数分别是什么意义? web访问模式问题(急)
取的只是当前页的items数。用DataSet.yourTable.Rows.Count
{
HttpContext.Current.Response.AppendHeader("Content-Disposition","attachment;filename=Excel.txt");
HttpContext.Current.Response.Charset = "gb2312";
HttpContext.Current.Response.ContentEncoding = System.Text.Encoding.Default;
HttpContext.Current.Response.ContentType = "application/ms-excel";//image/JPEG;text/HTML;image/GIF;vnd.ms-excel/msword
// HttpContext.Current.Response.ContentType ="application/Microsoft Excel";
// ctl.Page.EnableViewState = false;
System.IO.StringWriter tw = new System.IO.StringWriter();
System.Web.UI.HtmlTextWriter hw = new System.Web.UI.HtmlTextWriter(tw);
ctl.RenderControl(hw);
HttpContext.Current.Response.Write(tw.ToString());
HttpContext.Current.Response.End();
ctl.Visible = false;
}