New Zealand's new Copyright Law presumes 'Guilt Upon Accusation' and will Cut Off Internet Connections without a trial. is against this unjust law - help us

A Space for All Things .NET Related

RegisterForEventValidation can only be called during Render();

By James Hippolite, in , posted: 21-Aug-2008 09:38

This error comes when you are exporting the GridView control from Visual Studio. To solve this error you have to turn the eventValidation off.  You can do this in the web.config file but if you do, the eventValidation will be turned off for all the pages.

<pages enableEventValidation ="false" ></pages>

Alternatively, you can do this in the Page directive which will turn off the validation for a single page.

<%@ Page Language="C#" EnableEventValidation = "false" AutoEventWireup="true"

 CodeFile="ExportGridView.aspx.cs" Inherits="ExportGridView" %>

Other related posts:
Geek Post Monthly Newsletter Volume 2 Issue 6
Exam 70-300 Objective 3

Comment by Krishna Murari Agrawal, on 4-Sep-2008 16:02

that's what i was looking for.


Comment by rodrigo, on 4-Apr-2009 04:36

NO... not working.... this es my code... Seleccion do you help me?

Author's note by JamesHip, on 6-Apr-2009 08:39

Hola Rodrigo,

Donde esta su 'code'?

Me gusta te assistado, si possible.

Add a comment

Please note: comments that are inappropriate or promotional in nature will be deleted. E-mail addresses are not displayed, but you must enter a valid e-mail address to confirm your comments.

Are you a registered Geekzone user? Login to have the fields below automatically filled in for you and to enable links in comments. If you have (or qualify to have) a Geekzone Blog then your comment will be automatically confirmed and shown in this blog post.

Your name:

Your e-mail:

Your webpage:

JamesHip's profile

James Hippolite
New Zealand

Welcome to my technical blog. 

Here, I attempt to distill the Microsoft Certified Professional Developer knowledge I have accumulated since first qualifying MCP in 1996.  This blog started on 13 September 2007 as an off-shoot from my mixed up personal blog.  But it took a shot in the arm from Scott Hanselman's talk at TechEd New Zealand 08 "32 Ways To Make Your Blog Suck Less".