p2p.wrox.com Forums

p2p.wrox.com Forums (http://p2p.wrox.com/index.php)
-   ASP.NET 2.0 Professional (http://p2p.wrox.com/forumdisplay.php?f=215)
-   -   Invalid postback or callback argument (http://p2p.wrox.com/showthread.php?t=66001)

mallikalapati February 19th, 2008 07:23 AM

Invalid postback or callback argument
hi friends,

i am using gridview with template field buttons and at runtime when i click the button I am getting an error as follows

Invalid postback or callback argument. Event validation is enabled using <pages enableEventValidation="true"/> in configuration or <%@ Page EnableEventValidation="true" %> in a page. For security purposes, this feature verifies that arguments to postback or callback events originate from the server control that originally rendered them. If the data is valid and expected, use the ClientScriptManager.RegisterForEventValidation method in order to register the postback or callback data for validation.


planoie February 19th, 2008 10:46 AM

This usually happens when that data that is being posted could be harmful. An example would be a textbox in which you enter HTML. Because HTML can contain javascript tags which could be harmful, ASP.NET will, by default, throw the exception you are seeing because it fails post validation. If you do as the error message suggests and set EnableEventValidation to false, this problem should go away. However, be aware that you are opening up the possibility of malicious data entry.


sonicDace February 19th, 2008 06:58 PM

Actually, this happens when the source that triggered the event was not the gridview. I.E, you have some JavaScript on your page that calls the click() event on some link in your gridview, which in turn causes it to post back.

The "EnableEventValidation='true'" detects this as a security issue and blocks the event. If you want to allow your client-side code to interact with your gridview, set this to false


mallikalapati February 20th, 2008 04:15 AM

:)Thank you guys and my problem is solved


planoie February 20th, 2008 08:38 AM

sonicDace - Thanks for the correction. I think I need a vacation.


All times are GMT -4. The time now is 02:41 AM.

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.