“只能在Render();”中调用RegisterForEventValidation。 [英] "RegisterForEventValidation can only be called during Render();"

查看:146
本文介绍了“只能在Render();”中调用RegisterForEventValidation。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在将数据从gridview传输到excel时遇到此错误,任何人都可以向我建议解决方案RegisterForEventValidation只能在Render()期间调用;



我有一个解决方案,我应该做EnableEventValidation = false并在我的代码中生成事件VerifyRenderingInServerForm(控制控件)...我也这样做了..

现在我没有收到任何错误...但excel文件没有生成..帮助......

解决方案

我曾经在这里得到了一些帮助:



http://stackoverflow.com/questions/8908363/exporting -gridview-to-xls-paging-issue [ ^ ]



看看这对你有帮助:)期待你的评论。


用于生成excel文件的按钮..;将该按钮放在< asp:postbacktrigger xmlns:asp =#unknown> <触发器>的标签tab ...

如果ur网格正在进行分页,那么在将数据导出到excel时使用Datatable而不是使用gridview因为如果你使用gridview那么它将不会生成正确的excel文件...

或你可以做到这一点..而generatin excel再次从数据库中获取数据......


Iam getting this error while transferring data from gridview to excel, can any one suggest me the solution"RegisterForEventValidation can only be called during Render();"

I got a solution that i should do EnableEventValidation=false and generate the event VerifyRenderingInServerForm(Control control) in my code...i did this too..
now i am not getting any error...but excel file is not getting generated..help...

解决方案

I had once done this with some help from here:

http://stackoverflow.com/questions/8908363/exporting-gridview-to-xls-paging-issue[^]

See if that helps you too :) Looking forward for your comments.


The button that is supposd to generate the excel file..;place that button in the <asp:postbacktrigger xmlns:asp="#unknown"> tab of the <triggers> tab...
and if ur grid is doing paging then while exporting the data into excel use the Datatable instead of using the gridview coz if u use gridview then it will not generate proper excel file...
or u can do this..while generatin excel again get the data from the DB...


这篇关于“只能在Render();”中调用RegisterForEventValidation。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆