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:
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="ExportGridviewtoExcel.aspx.cs" Inherits="ExportGridviewtoExcel" EnableEventValidation="false"%> |
|
If you enjoyed this post, please support the blog below. It's FREE! Get the latest Asp.net, C#.net, VB.NET, jQuery, Plugins & Code Snippets for FREE by subscribing to our Facebook, Twitter, RSS feed, or by email. |
|||
Subscribe by RSS
Subscribe by Email
|
|||
|
|

Subscribe by RSS
Subscribe by Email
16 comments :
Hi, I tried that change as specified here, but I still get the same error. I am using the functionality in a user control and the user control is placed inside the main aspx page where I put this property. Are there any other changs?
Wow, so you disable validation and you call that "solving the problem".
Worked great once I included the fixes. Thanks for this, solved my current 'crisis'
That fixed it, THANKS!!!
sir gn, i am happy see your website.Am freshers to asp.net. I need your help. Now am creating master table screen . In that employee screen( branch id* is foreign key ) in aspx file, i want to show branch name * in dropdownlist.But in the gridview branch id only to be stored .Plz help me @ kamalakannan591989@gmail.com
Hello, I am Hitesh Gaur.(programmer)
It's a way to solve the problem Mr. Dasari. Before any one tries this I suggest, it will expose your web app/site to some attacks.
Yes, It is working.Thanks
Thanq very much sir,its working great
From Microsoft:
Security Note
This feature reduces the risk of unauthorized or malicious postback requests and callbacks. It is strongly recommended that you do not disable event validation.
Extender control 'ModalPopupTicket' is not a registered extender control. Extender controls must be registered using RegisterExtenderControl() before calling RegisterScriptDescriptors(). Parameter name: extenderControl
how can i solve this error...plz help me....as eary as possible
I don't know how to use CSV!!!
Yes dude it's work.... you great....
is it not true that disabling EnableEventValidation will make your site vulnerable to XSS attacks. i think one should use excel converting libraries.
Unable to cast object of type 'iTextSharp.text.html.simpleparser.CellWrapper' to type 'iTextSharp.text.html.simpleparser.TableWrapper'.
I have solve the problem. Thanks a lot!
I sir i am using u r code its working perfectly for grid view but i have some textbox on top of gridview i want export those values to pdf.
I have given like TextBox3.RenderControl(hw);
but its not showing in the pdf document..can u tell me why..and thanks in advance