Click here to Skip to main content
15,886,689 members
Please Sign up or sign in to vote.
5.00/5 (1 vote)
See more:
Dear All,,
Kindly check my issue:
I have been dealing with this bug for about two weeks and I NEED to solve it.
I have read every article available over the internet,but no result ,still the bug appears.I'm sure the solution is going to be very silly.I have a gridview inside an updatepanel,While sorting or paging I don't get the error,I only get it when I click on an Imagebutton or Linkbutton(Delete,Update):
So please check it:
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. 

Stack Trace:

[ArgumentException: 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.]
   System.Web.UI.ClientScriptManager.ValidateEvent(String uniqueId, String argument) +340
   System.Web.UI.Control.ValidateEvent(String uniqueID, String eventArgument) +69
   System.Web.UI.WebControls.CheckBox.LoadPostData(String postDataKey, NameValueCollection postCollection) +74
   System.Web.UI.WebControls.CheckBox.System.Web.UI.IPostBackDataHandler.LoadPostData(String postDataKey, NameValueCollection postCollection) +13
   System.Web.UI.Page.ProcessPostData(NameValueCollection postData, Boolean fBeforeLoad) +357
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1768
Posted
Updated 2-Jan-12 19:52pm
v2

Hi,


1. Check your buttons ClientIdMode. Have you change their value to static or something else ? Try the default value.

2. Try in Page_Load to register your controls async:
C#
ScriptManager sm = ScriptManager.GetCurrent(this.Page);
sm.RegisterAsyncPostBackControl(YourButton);

and then refresh your update panel programmatically: updatePanel.Refresh();

3. Put your buttons as triggers to your update panel:
ASP.NET
<asp:updatepanel xmlns:asp="#unknown">
    <triggers>
        <asp:asyncpostbacktrigger controlid="YourButton" eventname="Click" />
    </triggers>
</asp:updatepanel>


And i see that in your error there is something about a CheckBox. Do you have one on your Page ?
 
Share this answer
 
Comments
Afnan_ 4-Jan-12 7:18am    
Hey incaunu,
Thank you for replying,When I saw your reply I felt like there was still hope.Because I'm really desperate.
Point 2 and 3 I have tried them but didn't solve the issue.I going to give it another try by doing the three points together.

Yes,I do have checkbox.I use them for multidelete.

Thank you again.
incaunu 4-Jan-12 7:31am    
Ok, now that you confirmed that you have a CheckBox, try to do delete it, and then make the tests.
incaunu 4-Jan-12 7:35am    
And another ideea, the ClienIdMode of the Checkbox (and all other controls in your gridview control), try Predictable value.

Predictable - This algorithm is used for controls that are in data-bound controls. The ClientID value is generated by concatenating the ClientID value of the parent naming container with the ID value of the control. If the control is a data-bound control that generates multiple rows, the value of the data field specified in the ClientIDRowSuffix property is added at the end. For the GridView control, multiple data fields can be specified. If the ClientIDRowSuffix property is blank, a sequential number is added at the end instead of a data field value. Each segment is separated by an underscore character (_).
Afnan_ 4-Jan-12 7:38am    
I will try all your solutions.

:)
Afnan_ 4-Jan-12 8:34am    
Point#1 didn't work.I get this message " Validation(ASP.Net):Attribute 'ClientIDMode' is not a valid attribute of element 'CheckBox'".I'm working on ASP.NET 2.0
Point#2 and 3 give same error.
Use Page_PreRender instead of page_Load to bind data.
 
Share this answer
 
v2
Hi,
Click here[^]
 
Share this answer
 
Comments
Afnan_ 4-Jan-12 8:17am    
Hello,
Thank you ,but I already have checked this site and none of its solutions solved my error.
Setting <%@Page EnabledEventValidation ="true"%> to false,It only makes things worse.
My binding is insida a IF NOT ISPOSTBACK.
I only have one updatepanel.
sameer8k 26-Nov-12 1:08am    
first put <%@ Page Language="C#" AutoEventWireup="true" EnableEventValidation="false" EnableViewState="true" %> then <asp:UpdatePanel runat="server" ID="s"> <triggers> <asp:asyncpostbacktrigger controlid="Button1" eventname="Click" /> </triggers> this will solve your problem..
This is NOT recommended, however easy it may seem.
EnableEventValidation="false" %>]]>
 
Share this answer
 
If you already have something like <%@ Page so just add the rest => EnableEventValidation="false" %>
 
Share this answer
 
Error:
HTML
Sys.WebForms.PageRequestManagerServerErrorException: Sys.WebForms.PageRequestManagerServerErrorException: An unknown error occurred while processing the request on the server. The status code returned from the server was: 500


Solution :
HTML
<appsettings>
<add key="aspnet:MaxHttpCollectionKeys" value="100000" />
</appsettings>
 
Share this answer
 
v2
This can be caused if you do not know much about the Asp.Net Page Life Cycle Events. Wrong way of proggramming could lead to this problem.
However there are ways out there to resolve it. This Error happens because Asp.Net Framework could not find the control that caused the
Postback .
 
Share this answer
 
Comments
CHill60 20-Dec-13 10:13am    
The question is 2 years old and resolved. Your solution is not clear
Thanks buddy....i have got my issue resolved with the help of your solution. basically i have upgraded my application from 1.1 to 4.0 and during that migration i was facing the issue that whenever i click on the grid that is bind it throws me the mentioned error. Hence i have added EnableEventValidation="false" under page directive and it worked like a charm :) thanks a ton.
 
Share this answer
 
Comments
CHill60 11-Feb-15 7:19am    
We have no idea which of the previous 7 posters you are thanking as you have posted this as a "solution" to the 3-year old question. If you wish to respond to a specific post use the "Have a Question or Comment" link next to the post, or the "Reply" link next to a comment

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