Click here to Skip to main content
15,881,803 members
Please Sign up or sign in to vote.
2.00/5 (1 vote)
See more:
In my webform I am using Jquery and Javascript for popup window and clientside validation.

In the popup window I add the combobox item using javascript. It's all works well.
But When I save the form
The following error occurs

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.



If I remove the update panel, when I select newly additem in the combobox, the above error is occured

Why? help me....
Posted
Updated 9-Nov-12 0:04am
v2
Comments
mhd.sbt 9-Nov-12 8:34am    
do you have any code in your page load of this page?
[no name] 9-Nov-12 13:42pm    
post the code for the page and the popup script and we can llok at it
mickfarrow 9-Nov-12 14:46pm    
Hi,
I had this problem a few weeks back also, it turns out that this behaviour is correct, when the page is posted back to the server it is expected to have the same controls present as when it was served up to the client. In your example you have used JQuery to construct a combo box, therefore the event validation fails as it detects the new control.
The easiest way to overcome this is by using server side code to populate the combo box. If you cannot do this you can turn off event validation, or use a method such as ajax instead of posting the form back.

Easy/direct solution can be adding enableEventValidation="false" in your Page directive or Web.config file.

Detailed explanation here: Invalid postback or callback argument solution. Event validation...[^]

Interesting to read one blog entry related to same: “Invalid postback or callback argument” in ASP.NET[^] - It exposes few other reasons on why one can get the same error. Nice read.
 
Share this answer
 
in the @page tag set enableEventValidation="false" you get resolved
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900