Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C# ASP.NET Ajax
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 2-Jan-12 19:43pm
Afnan_696
Edited 2-Jan-12 19:52pm
Mehdi Gholam240.6K
v2
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

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:
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: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 ?
  Permalink  
Comments
Afnan_ at 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 at 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 at 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_ at 4-Jan-12 7:38am
   
I will try all your solutions.
 
:)
Afnan_ at 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.
incaunu at 5-Jan-12 8:13am
   
If you could post some source code, maybe I can help you.
Afnan_ at 8-Jan-12 3:56am
   
I have tried to post the code ,but only part of the code appears, because here the text to post is limited.
incaunu at 8-Jan-12 4:01am
   
send me an email with your code: net13ro@yahoo.com
Afnan_ at 8-Jan-12 8:56am
   
I have sent you the code,thank you in advance.
:)
incaunu at 8-Jan-12 13:54pm
   
check you email.
Afnan_ at 9-Jan-12 1:40am
   
Thank you very much I adjusted your code with my asp framwork and now it is working like a charm.
 
Wish you all the best.
<3 <3
incaunu at 9-Jan-12 3:02am
   
I'm glad I helped you.
 
Good luck in the future.
Jerry Isenhower at 2-Nov-12 14:32pm
   
Can you not post what you did to correct the problem? Others on here can't see the solution if you don't post it or tell us what change you did to make it work.
kesy987 at 25-Jul-12 6:51am
   
please do help me out ..im stuck with the same problem ?
 

thanx
sameer8k at 26-Nov-12 1:07am
   
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..
sameer8k at 26-Nov-12 0:47am
   
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..
Saving Purpose at 11-Jul-13 13:28pm
   
Thankx sameer8k! problem solved for me!
Appdev(Icode) at 25-Mar-14 9:06am
   
Wow even though it was an old thread it helps me alot to solve my problem.
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 4

Use Page_PreRender instead of page_Load to bind data.
  Permalink  
v2
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 3

If you already have something like <%@ Page so just add the rest => EnableEventValidation="false" %>
  Permalink  
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 5

Error:
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 :
<appsettings>
<add key="aspnet:MaxHttpCollectionKeys" value="100000" />
</appsettings>
  Permalink  
v2
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 6

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 .
  Permalink  
Comments
CHill60 at 20-Dec-13 10:13am
   
The question is 2 years old and resolved. Your solution is not clear
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

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

Solution 7

This is NOT recommended, however easy it may seem.
<![CDATA[<%@ Page so just add the rest => EnableEventValidation="false" %>]]>
  Permalink  

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



Advertise | Privacy | Mobile
Web03 | 2.8.140926.1 | Last Updated 23 Sep 2014
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