Introduction: in this post I will explain how we can solve the error “RegisterForEventValidation can only be called during Render();"
In the last article I have explained Control 'grdstudent' of type 'GridView' must be placed inside a form tag with runat=server, How to Export Gridview Data to PDF in Asp.net and How to Export Gridview Data to CSV in Asp.net.
Error occur when we try to Export the Data from Controls to Pdf, Excel, Word, CSV. To solve this error add EnableEventValidation = "false" to @Page directive of .aspx page as shown below:
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Gridview_SelectExportRow.aspx.cs" Inherits="Gridview_SelectExportRow" EnableEventValidation="false" %>
I hope it will resolve your problem.
What do you think about this article?
If you found this article useful, please share and follow on Facebook, Twitter, Google Plus and other social media websites. To get free updates subscribe to newsletter. Please put your thoughts and feedback in comments section.