Click here to Skip to main content
Sign Up to vote bad
good
See more: C#2.0ASP.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:26


5 solutions

Try this,
 
Set EventValidation to false for the page and also override VerifyRenderingInServerForm in code behind,
public override void VerifyRenderingInServerForm(Control control)
{
 
}
  Permalink  
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  
Comments
kiransolkar - 29 Feb '12 - 6:39
it works thnx
pratheeshsaji - 8 Mar '13 - 7:46
thanq so much..
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  
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" enableEventValidation ="false" Inherits="Default" %>
 

 

also add
 
public override void VerifyRenderingInServerForm(Control control)
{
 
}
  Permalink  
i was also getting the same problem...i did all the things that is suggested here...now i am not getting that error but the excel file is not getting generated..please help..
  Permalink  
Comments
André Kraak - 31 Dec '12 - 3:39
You posted a question as an solution which was probably not want you intended. If you have a question or comment about the original question use the "Have a Question or Comment?" option beneath the question. On the other hand if you have a similar problem your best option is to create your own new question, for this use the "Ask a Question" button at the top of the page. Using an solution like this will give the people the impression that the question has been answered and perhaps not look at it, causing the OP not to get an answer to his/her question. Please move the content of this solution to the appropriate section and remove the solution. Thank you.

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

  Print Answers RSS
Your Filters
Interested
Ignored
     
0 Mohammed Hameed 268
1 OriginalGriff 236
2 Sergey Alexandrovich Kryukov 153
3 Mayur_Panchal 153
4 CPallini 100
0 Sergey Alexandrovich Kryukov 8,171
1 OriginalGriff 6,246
2 CPallini 3,532
3 Rohan Leuva 2,703
4 Maciej Los 2,234


Advertise | Privacy | Mobile
Web04 | 2.6.130516.1 | Last Updated 31 Dec 2012
Copyright © CodeProject, 1999-2013
All Rights Reserved. Terms of Use
Layout: fixed | fluid