求GridView导出到excel,javascript源码?
求GridView导出到excel,javascript源码?xiexie
C# code:
public static void ExportExcel(ref System.Web.UI.WebControls.GridView gv, string strFileName)
{
strFileName = System.Web.HttpUtility.UrlEncode(strFileName, System.Text.Encoding.UTF8);
System.Web.HttpContext.Current.Response.Clear();
System.Web.HttpContext.Current.Response.Buffer = true;
System.Web.HttpContext.Current.Response.Charset = "UTF-8";
System.Web.HttpContext.Current.Response.AppendHeader("Content-Disposition", "online; filename=" + strFileName + ".xls");
System.Web.HttpContext.Current.Response.ContentEncoding = System.Text.Encoding.UTF8;
System.Web.HttpContext.Current.Response.ContentType = "application/ms-excel";
//System.Web.HttpContext.Current.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);
oHtmlTextWriter.Write("<style>.txt{MSO-NUMBER-FORMAT:\\@}</style>");
gv.RenderContro
相关问答:
如何实现当鼠标悬停控件上时,出现该控件的尾部显示对应的层,鼠标移动到该层上进行相应的操作,当鼠标移除时(不在控件上也不在层上)层隐藏,
http://topic.csdn.net/u/20090830/23/5e5ded07-7216-46c2-9712- ......
我的源文件如下:
<html>
<head> <title>show picture </title>
<script>
function change(fileName)
{
  ......
以下是一段JavsScript脚本,但运行时总会产生 “Microsoft JScript 运行时错误: 'null' 为空或不是对象”异常,大家帮看一下。
<form id="form1" runat="server">
< ......
JScript code:
function C1(){}
function C2(){}
C2.prototype=new C1();
function C3(){}
C3.prototype=new C2();
var obj=new C3();
function C4(){}
C3.prototype=new C4();
alert(obj insta ......