Wrox Programmer Forums
Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 2.0 > ASP.NET 2.0 Professional
| Search | Today's Posts | Mark Forums Read
ASP.NET 2.0 Professional If you are an experienced ASP.NET programmer, this is the forum for your 2.0 questions. Please also see the Visual Web Developer 2005 forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 2.0 Professional section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old February 19th, 2008, 07:23 AM
Authorized User
 
Join Date: Feb 2008
Location: Bangalore, A.P, India.
Posts: 34
Thanks: 0
Thanked 0 Times in 0 Posts
Default 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.


AMR
 
Old February 19th, 2008, 10:46 AM
planoie's Avatar
Friend of Wrox
Points: 16,481, Level: 55
Points: 16,481, Level: 55 Points: 16,481, Level: 55 Points: 16,481, Level: 55
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Aug 2003
Location: Clifton Park, New York, USA.
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts
Default

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.

-Peter
peterlanoie.blog
 
Old February 19th, 2008, 06:58 PM
Authorized User
 
Join Date: Nov 2003
Location: Hollywood, Fl, USA.
Posts: 63
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to sonicDace Send a message via MSN to sonicDace Send a message via Yahoo to sonicDace
Default

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

thanks
 
Old February 20th, 2008, 04:15 AM
Authorized User
 
Join Date: Feb 2008
Location: Bangalore, A.P, India.
Posts: 34
Thanks: 0
Thanked 0 Times in 0 Posts
Default

:)Thank you guys and my problem is solved

AMR
 
Old February 20th, 2008, 08:38 AM
planoie's Avatar
Friend of Wrox
Points: 16,481, Level: 55
Points: 16,481, Level: 55 Points: 16,481, Level: 55 Points: 16,481, Level: 55
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Aug 2003
Location: Clifton Park, New York, USA.
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts
Default

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

-Peter
peterlanoie.blog




Similar Threads
Thread Thread Starter Forum Replies Last Post
Error: Invalid postback or call back argument kalyanykk ASP.NET 2.0 Basics 0 August 26th, 2008 06:03 AM
Invalid Argument ppenn Access VBA 2 May 14th, 2007 10:11 AM
Invalid postback or callback argument everest ASP.NET 2.0 Professional 2 January 9th, 2007 08:28 AM
Invalid postback or callback argument. kingw BOOK: Professional Ajax ISBN: 978-0-471-77778-6 1 January 1st, 2007 09:49 PM
Invalid Argument.... baNTON Access VBA 4 April 27th, 2004 06:18 AM





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