只能在执行Render() 的过程中调用 RegisterForEventValidation
来源:互联网 发布:湖南网络公关公司 编辑:程序博客网 时间:2024/06/06 10:47
将页面上的gridview导出到excel中时会遇到这样一个问题:“只能在执行 Render() 的过程中调用 RegisterForEventValidation”
解决的方法有两种:
第一种:在Web.Config文件中:在<system.web></system.web>标记中添加如下代码:<不推荐>
<system.web>
<pages enableEventValidation="false"> </pages>
</system.web>
第二种:在具体的.aspx页面的源代码中修改代码,如下:
<%@ Page Language="C#" Inherits=" OutputData" AutoEventWireup="true" CodeFile=" OutputDataThree.aspx.cs" EnableEventValidation="false"%>
EnableEventValidation 默认值为true,它将启动事件验证。此功能验证回发或回调事件的参数是否来源于最初呈现这些事件的服务器控件。
另外,如果页面含有一个linkbutton,并在后台创建对应的Click事件处理程序,此时想要将页面的table导出到excel时,也会报出上述同样的错误,此时解决方法有两种:
第一种:在Click事件处理中,将linkbutton的Visible设置成false
第二种:设置<@Page EnableEventValidation="false">
修改完毕后再次运行程序,又可以正确响应事件。关于出现的异常,可以认为在输出时候没有包含linkbutton,可是再提交到后台的时候却有相应的内容,前后不一致,所以在开启事件校验的情况下.NET抛出了异常。
原文地址:http://blog.csdn.net/daidailiuhome/article/details/6079211
- 只能在执行 Render() 的过程中调用 RegisterForEventValidation;
- 只能在执行Render() 的过程中调用 RegisterForEventValidation
- 只能在执行Render() 的过程中调用 RegisterForEventValidation
- 只能在执行 Render() 的过程中调用 RegisterForEventValidation
- 只能在执行Render() 的过程中调用 RegisterForEventValidation
- 只能在执行 Render() 的过程中调用 RegisterForEventValidation
- 只能在执行 Render() 的过程中调用 RegisterForEventValidation;
- 只能在执行 Render() 的过程中调用 RegisterForEventValidation
- 只能在执行Render()的过程中调用RegisterForEventValidation
- 只能在执行Render() 的过程中调用 RegisterForEventValidation
- 只能在执行Render() 的过程中调用 RegisterForEventValidation
- 只能在执行 Render() 的过程中调用 RegisterForEventValidation(RegisterForEventValidation can only be called during Render(); )
- 只能在执行 Render() 的过程中调用 RegisterForEventValidation(RegisterForEventValidation can only be called during Render()
- 只能在执行 Render() 的过程中调用 RegisterForEventValidation(RegisterForEventValidation can only be called during Render(); )
- 只能在执行 Render() 的过程中调用 RegisterForEventValidation(RegisterForEventValidation can only be called during Render();
- 只能在执行 Render() 的过程中调用 RegisterForEventValidation(RegisterForEventValidation can only be called during Render(); )
- 只能在执行 Render() 的过程中调用 RegisterForEventValidation(RegisterForEventValidation can only be called during Render()
- 只能在执行 Render() 的过程中调用 RegisterForEventValidation(RegisterForEventValidation can only be called durin
- 关于MySQL安装过程中遇到的问题
- ajax执行后台方法执行了两次
- 2017/9/14 (学习日记)(FAT12文件簇链的寻找)
- WamapServer Apache服务器起不来(非端口占用)
- NKOJ-3777 卡牌操作
- 只能在执行Render() 的过程中调用 RegisterForEventValidation
- 字符转数字不使用str.toInt方法转为整型
- HDU
- 常见的el表达式的用法
- Ubuntu 下实现FTP服务器,SSH服务器,邮件服务器,Web服务器(二)
- Linux:常用键盘快捷键
- map
- Opencv学习笔记(一) Eclispe上配置opencv
- python编码错误UnicodeDecodeError: ‘ascii’/'utf-8′ codec can’t decode byte 0xb8 in position 50: ord