Introduction:
Here I will explain how to solve the problem RegisterForEventValidation can only be called during Render(); during export of gridview to excel or word or csv using asp.net.
Description:
Here I will explain how to solve the problem RegisterForEventValidation can only be called during Render(); during export of gridview to excel or word or csv using asp.net.
Description:
During export a gridview data to excel, word, notepad or csv I got error like
RegisterForEventValidation can only be called during Render();
This error occurs whenever we are trying to render control to response. To solve this problem I have added EnableEventValidation="false" to @Page directive of aspx page that should be just like this
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="ExportGridviewtoExcel.aspx.cs"Inherits="ExportGridviewtoExcel" EnableEventValidation="false"%> |
By Setting EnableEventValidation="false" property to @Page directive of aspx page the problem has solved automatically.
I hope it helps to solve your problem.
Happy Coding………
0 comments:
Post a Comment