Click here to Skip to main content
12,395,388 members (65,793 online)
Rate this:
 
Please Sign up or sign in to vote.
See more: C#2.0 C# ASP.NET
Cry | :(( 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();"
Posted 29-Nov-09 17:26pm
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 1

Try this,

Set EventValidation to false for the page and also override VerifyRenderingInServerForm in code behind,
public override void VerifyRenderingInServerForm(Control control)
{
 
}
  Permalink  
Comments
Chinwendu 25-Apr-14 6:53am
   
Setting the page EventValidation to false helped solved my challange.
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 4

hi,
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. */
    }
  Permalink  
v2
Comments
kiransolkar 29-Feb-12 6:39am
   
it works thnx
Ramprakashram 30-Sep-13 0:55am
   
yep..its working now :) tnq
pratheeshsaji 8-Mar-13 7:46am
   
thanq so much..
manojmadhuranga 18-Dec-13 2:26am
   
Thanks..It worked for me..just doing this..[ EnableEventValidation="false" ]
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 2

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"
  Permalink  
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 3

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" enableEventValidation ="false" Inherits="Default" %>




also add

public override void VerifyRenderingInServerForm(Control control)
{
 
}
  Permalink  
v2
Comments
Jhonnie Walker 7-Nov-13 7:09am
   
is this a good way to solve this problem..??

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month


Advertise | Privacy | Mobile
Web01 | 2.8.160721.1 | Last Updated 10 Jun 2016
Copyright © CodeProject, 1999-2016
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100