- r - 以节省内存的方式增长 data.frame
- ruby-on-rails - ruby/ruby on rails 内存泄漏检测
- android - 无法解析导入android.support.v7.app
- UNIX 域套接字与共享内存(映射文件)
我的页面上有一个 GridView ,我想将它导出到 Excel 工作表,下面是我为完成此任务而编写的代码,这里我已经将数据集传递给绑定(bind)网格的方法,btnExcelExport
是将网格内容导出到 Excel 工作表的按钮:-
private void BindGridView(DataSet ds)
{
if (ds.Tables.Count > 0)
{
if (ds.Tables[0].Rows.Count > 0)
{
GVUserReport.DataSource = ds;
GVUserReport.DataBind();
btnExcelExport.Visible = true;
}
}
}
protected void btnExcelExport_Click(object sender, EventArgs e)
{
Response.Clear();
Response.AddHeader("content-disposition","attachment;filename=FileName.xls");
Response.Charset = "";
Response.Cache.SetCacheability(HttpCacheability.NoCache);
Response.ContentType = "application/vnd.xls";
System.IO.StringWriter stringWrite = new System.IO.StringWriter();
System.Web.UI.HtmlTextWriter htmlWrite = new HtmlTextWriter(stringWrite);
GVUserReport.RenderControl(htmlWrite);
Response.Write(stringWrite.ToString());
Response.End();
}
public override void VerifyRenderingInServerForm(Control control)
{
return;
}
现在,当我调试时,我发现网格已成功绑定(bind),但在尝试将其导出到 Excel 时,出现此错误:
"Microsoft JScript runtime error: Sys.WebForms.PageRequestManagerParserErrorException: The message received from the server could not be parsed."
最佳答案
我解决了这个问题。当我使用 UpdatePanel
时,我在页面的 Page_Load
事件中添加了以下代码,它对我有用:
protected void Page_Load(object sender, EventArgs e) {
ScriptManager scriptManager = ScriptManager.GetCurrent(this.Page);
scriptManager.RegisterPostBackControl(this.btnExcelExport);
//Further code goes here....
}
关于c# - Sys.WebForms.PageRequestManagerParserErrorException : The message received from the server could not be parsed,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11221033/
我正在编写一个 python 程序,它将所有输入都大写(替代非工作 tr '[:lowers:]' '[:upper:]')。语言环境是 ru_RU.UTF-8,我使用 PYTHONIOENCODIN
我收到错误;MVC Microsoft JScript 运行时错误:Sys.ArgumentTypeException:“Sys._Application”类型的对象无法转换为“Sys._Applic
尝试使用 IDLE 在 Python 3.7.4 版本中安装 sys 包时,出现以下错误: 输入:C:\Users\UserName\Downloads>pip install sys 输出: 采集系
我对 Python 还很陌生,所以我还在学习这门语言。我遇到的一件事是重新分配 sys.stdout 以更改打印的默认输出。所以我写了这个作为测试: import sys sys.stdout = o
我应该选择 sys.exc_info()在 sys.last_value和 friend (sys.last_type,sys.last_traceback)? 最佳答案 查看sys.last_val
我的 shell 脚本中出现奇怪的错误。使用这个: $find /sys/class/ -name temp -exec cat '{}' ';' 我得到输出 77000 find: `/sys/ke
我只想从 sys 库导入 argv 和可执行函数。 所以我使用 from 和 import 来指定这些函数,如下所示:- from sys import argv from sys import ex
我想找到调用我的程序的命令行参数,即 sys.argv,但我想在 Python 使 sys.argv 可用之前执行此操作.这是因为我在 usercustomize.py 中运行代码,该代码由 site
sys和os.sys在python中有什么区别?我见过很多项目在导入os时使用sys。当我尝试 dir(sys) 和 dir(os.sys) 时,它们的功能相同,输出也相同。 我经常看到像这样使用 s
create table T ( ID number, COL1 SYS.XMLTYPE )XMLType COLUMN COL1 STORE AS CLOB; select obj#,col
下面的 SQL 似乎可以工作,但我想知道是否有更好的方法来编写它。我正在尝试选择具有特定名称的所有 View 和表。如果找到匹配项,则应该只有一个返回值。 SELECT DISTINCT name F
在我的客户端(使用 LWJGL)中,我使用以下代码: private static long getTime() { return (Sys.getTime() * 1000) / Sys.g
我的老板让我看一些旧代码,其中所有内容都被发送到 stderr。我知道 stderr 应该有警告和错误,但他们什么时候才真正应该转到 stdout? 此程序是一项服务。它发送到 stderr 的一些消
使用 importlib,“Meta Path Finder”(通过遍历 sys.meta_path 找到)和“Path Entry Finder”(通过遍历 sys.path_hooks 找到)有什
我正在运行这个命令来安装 os_sys 包: pip3 install os_sys 但收到此错误: ERROR: os-sys has an invalid wheel, could not rea
如果我查询sys.dm_database_encryption_keys,它返回的encryption_state为3(加密),percent_complete 0。如果我查询 sys.databas
有人可以向我解释一下这些不同的环境函数具体有什么作用吗?即哪个返回什么帧?阅读文档后我完全困惑了(http://stat.ethz.ch/R-manual/R-patched/library/base
查看其他 stackoverflow 帖子后,我似乎无法解决这个重定向问题。我想做的是抑制 stdout 和 stderr,然后在捕获错误后恢复它们。抑制效果很好,但恢复它们只成功了一半。 如果我尝试
这个问题在这里已经有了答案: Understanding slicing (38 个答案) 关闭 3 个月前。 我写了这段代码: #!/usr/bin/env python import sys i
我正在创建一个名为 Qt ( Github link ) 的模块,我在其中为另一个模块起别名(例如 PyQt4),这样当我导入 Qt 我实际上正在导入 PyQt4: from Qt import Qt
我是一名优秀的程序员,十分优秀!