Click here to Skip to main content
12,757,882 members (35,355 online)
Rate this:
 
Please Sign up or sign in to vote.
See more: C#2.0 C# ASP.NET
:(( 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 18:26pm
Updated 15-Oct-16 2:25am
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..??
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 10

Yes this is right we need to do the following:

1. .cs file add the following: //Change the Header Row back to white color
// HeaderRow-Style=#FFFFFF


// Style.Add("background-color", '#-d-f-5-015');


2. //.AS-PX file add the following:

// Enable-Event-Validation="false" inside <%@ Page directive

This makes it work like a charm!
  Permalink  
Comments
NotPolitcallyCorrect 15-Oct-16 7:27am
   
Oh very well done. Resurrecting a SEVEN year old already answered question just to get those oh-so-valuable worthless internet points.

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
Web02 | 2.8.170217.1 | Last Updated 15 Oct 2016
Copyright © CodeProject, 1999-2017
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