RegisterForEventValidation只能在Render()期间调用; [英] RegisterForEventValidation can only be called during Render();
本文介绍了RegisterForEventValidation只能在Render()期间调用;的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
:((大家好,
)在将数据从gridview传输到excel时出现此错误,任何人都可以向我建议解决方案只能在Render()期间调用RegisterForEventValidation;
:(( Hi all,
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();"
推荐答案
试试这个,
设置EventValidation
到页面为false,并在后面的代码中覆盖VerifyRenderingInServerForm
,
Try this,
SetEventValidation
to false for the page and also overrideVerifyRenderingInServerForm
in code behind,
public override void VerifyRenderingInServerForm(Control control)
{
}
i之前也遇到过同样的问题以下更改我的问题解决了。
请检查
i also faced with the same problem before and finally with the following changes my problem solved.
please check
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Records.aspx.cs" Inherits="Records"
MasterPageFile="~/Master.master" EnableEventValidation="false" %>
public override void VerifyRenderingInServerForm(Control control)
{
/* Confirms that an HtmlForm control is rendered for the specified ASP.NET
server control at run time. */
}
嘿只是设置了viewstate false
//关闭视图状态
this.EnableViewState = False;
//从Content-Type标题中删除字符集
Response.Charset = String。空;
和
EnableEventValidation =false
hey just set viewstate false
//Turn off the view state
this.EnableViewState = False;
//Remove the charset from the Content-Type header
Response.Charset = String.Empty;
and
EnableEventValidation="false"
这篇关于RegisterForEventValidation只能在Render()期间调用;的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文