RegisterForEventValidation can only be called during Render();

Many time we are getting this error while transferring data from gridview to excel,
A error message "RegisterForEventValidation can only be called during Render();"
We can solve this error to add  EnableEventValidation="false" in source code

Example:-
<%@ Page Title="" Language="C#" MasterPageFile="~/admin/adminindex.master" AutoEventWireup="true"
    CodeFile="Contact.aspx.cs" Inherits="admin_Contact" EnableEventValidation="false" %>


And we need to add in code behind
public override void VerifyRenderingInServerForm(Control control)
    {
        /* Verifies that the control is rendered */
    }



For more post:-
RegisterForEventValidation can only be called during Render(); RegisterForEventValidation can only be called during Render(); Reviewed by NEERAJ SRIVASTAVA on 9:21:00 PM Rating: 5

No comments:

Powered by Blogger.