Click here to Skip to main content
Rate this: bad
Please Sign up or sign in to vote.
See more: C# ASP.NET
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 8-Nov-12 23:51pm
Edited 9-Nov-12 0:04am
mehdi.sabet at 9-Nov-12 8:34am
do you have any code in your page load of this page?
Mathlab at 9-Nov-12 13:42pm
post the code for the page and the popup script and we can llok at it
mickfarrow at 9-Nov-12 14:46pm
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.
Rate this: bad
Please Sign up or sign in to vote.

Solution 1

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.
Rate this: bad
Please Sign up or sign in to vote.

Solution 2

in the @page tag set enableEventValidation="false" you get resolved

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

  Print Answers RSS
0 mhegazy94 460
1 Sergey Alexandrovich Kryukov 400
2 Kornfeld Eliyahu Peter 315
3 Gihan Liyanage 147
4 Sibeesh KV 145
0 Sergey Alexandrovich Kryukov 6,890
1 OriginalGriff 6,761
2 CPallini 5,350
3 George Jonsson 3,609
4 Gihan Liyanage 2,797

Advertise | Privacy | Mobile
Web01 | 2.8.140922.1 | Last Updated 10 Nov 2012
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100