Thursday, August 21, 2008

RegisterForEventValidation can only be called during Render();

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" %>

No comments:

Post a Comment