asp.net asp.net怎么调用另存功能 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 分情况 导出的时候就有类似弹出路径选择的对话框GridView tmpGv = new GridView(); DataSet ds = new DataSet(); SqlDataAdapter da = new SqlDataAdapter(cmd); da.Fill(ds, "TitleName "); tmpGv.DataSource = ds; tmpGv.DataMember = "TitleName "; tmpGv.DataBind(); ToExcel(tmpGv, "Daily "); ////// public void ToExcel(System.Web.UI.Control ctl, string FileName) { HttpContext.Current.Response.Charset = "UTF-8 ";//UTF-8 HttpContext.Current.Response.ContentEncoding = System.Text.Encoding.Default; HttpContext.Current.Response.ContentType = "application/ms-excel "; HttpContext.Current.Response.AppendHeader( "Content-Disposition ", "attachment;filename= " + " " + FileName + ".xls "); //ctl.Page.EnableViewState = true; System.IO.StringWriter tw = new System.IO.StringWriter(); HtmlTextWriter hw = new HtmlTextWriter(tw); ctl.RenderControl(hw); HttpContext.Current.Response.Write(tw.ToString()); HttpContext.Current.Response.End(); } 先弹出保存对话框,public void ToExcel(System.Web.UI.Control ctl, string FileName) { HttpContext.Current.Response.Charset = "UTF-8 ";//UTF-8 HttpContext.Current.Response.ContentEncoding = System.Text.Encoding.Default; HttpContext.Current.Response.ContentType = "application/ms-excel "; HttpContext.Current.Response.AppendHeader( "Content-Disposition ", "attachment;filename= " + " " + FileName + ".xls "); //ctl.Page.EnableViewState = true; System.IO.StringWriter tw = new System.IO.StringWriter(); HtmlTextWriter hw = new HtmlTextWriter(tw); ctl.RenderControl(hw); HttpContext.Current.Response.Write(tw.ToString()); HttpContext.Current.Response.End(); } 引用一下楼上的 关于获得GRIDVIEW的IMAGEFIELD类型的图片路径的问题。 大家来帮忙哦!参与有份!急急急。。。 web.config 的location web.config 配置如下,提示 ConnectionString 属性尚未初始化 c#传变量到js 如何在float中取两位小数 这个字符串应该如何截取? asp.net如何实现异步上传文件 直接执行拼接SQL有数据,写带参数的就没有数据了,请帮看下代码。 TMD,用了一年多的ASP.Net Beta1版 RadioButtonList 不支持代码块 那位高手做过RTX二次开发
DataSet ds = new DataSet();
SqlDataAdapter da = new SqlDataAdapter(cmd);
da.Fill(ds, "TitleName ");
tmpGv.DataSource = ds;
tmpGv.DataMember = "TitleName ";
tmpGv.DataBind();
ToExcel(tmpGv, "Daily ");
//////
public void ToExcel(System.Web.UI.Control ctl, string FileName)
{
HttpContext.Current.Response.Charset = "UTF-8 ";//UTF-8
HttpContext.Current.Response.ContentEncoding = System.Text.Encoding.Default;
HttpContext.Current.Response.ContentType = "application/ms-excel ";
HttpContext.Current.Response.AppendHeader( "Content-Disposition ", "attachment;filename= " + " " + FileName + ".xls ");
//ctl.Page.EnableViewState = true;
System.IO.StringWriter tw = new System.IO.StringWriter();
HtmlTextWriter hw = new HtmlTextWriter(tw);
ctl.RenderControl(hw);
HttpContext.Current.Response.Write(tw.ToString());
HttpContext.Current.Response.End();
}
public void ToExcel(System.Web.UI.Control ctl, string FileName)
{
HttpContext.Current.Response.Charset = "UTF-8 ";//UTF-8
HttpContext.Current.Response.ContentEncoding = System.Text.Encoding.Default;
HttpContext.Current.Response.ContentType = "application/ms-excel ";
HttpContext.Current.Response.AppendHeader( "Content-Disposition ", "attachment;filename= " + " " + FileName + ".xls ");
//ctl.Page.EnableViewState = true;
System.IO.StringWriter tw = new System.IO.StringWriter();
HtmlTextWriter hw = new HtmlTextWriter(tw);
ctl.RenderControl(hw);
HttpContext.Current.Response.Write(tw.ToString());
HttpContext.Current.Response.End();
}
引用一下楼上的