EnableEventValidation error on button postback using a multipart form in .NET v2.0

I had a problem today using a multipart form which gave me the following error:

 

“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.”

 

The code I’m using worked with .net Beta 2 but broke after upgrading. I tried adding the

 

<%@ Page EnableEventValidation="true" %>

 

setting, tried overriding Page.Render and adding the

 

ClientScriptManager.RegisterForEventValidation(btnSubmit.UniqueID)

 

 all to no avail. I finally got it working by setting validation to false e.g.:

 

<%@ Page EnableEventValidation="false" %>

 

I didn’t find much documentation googling this error so, hope it helps.

 

 

  • Share This Post:
  • Share on Twitter
  • Share on Facebook
  • Share on Technorati
Print | posted on Thursday, February 02, 2006 2:24 PM

Feedback

# re: EnableEventValidation error on button postback using a multipart form in .NET v2.0

left by Jim Wright at 2/21/2006 1:13 PM Gravatar
Hey!

I had this problem too -- the fix you list above certainly works, but in general I've found that the problem occurs when there's something else weird going on with the page (bad javascript, css, etc).

In my case, it was missing a quote on a "style" tag (css) for a <td> cell.

Hope that helps!

jim

# re: EnableEventValidation error on button postback using a multipart form in .NET v2.0

left by Sean G. at 2/21/2006 1:39 PM Gravatar
I had a similiar problem. I fixed it by putting my databinding code in the Page_Load event in a !Page.IsPostBack block. I got the solution here:
http://channel9.msdn.com/ShowPost.aspx?PostID=159495

# re: EnableEventValidation error on button postback using a multipart form in .NET v2.0

left by Abbad Minhas at 7/18/2006 6:18 AM Gravatar
I have had this problem when working with gridview, and using the paging functionality. Setting the value to false definately fixes the problem but i'm still wondering whether if this would affect other controls present on that page ... not much documentation is available sadly in regards to this :(

# re: EnableEventValidation error on button postback using a multipart form in .NET v2.0

left by Brian at 8/2/2006 8:27 AM Gravatar
It's been awhile since I looked at this, but I think it has something to do with adding the encryption type to the form e.g.

<form id="frmUpload" enctype="multipart/form-data" >

Which, if I remember correctly, you remove this to fix the error (or include it with EnableEventValidation=false)

# re: EnableEventValidation error on button postback using a multipart form in .NET v2.0

left by prashant at 8/23/2006 3:41 AM Gravatar
I am working with visual studio 2005 and I have got a site which is converted from visual studio 2003. On clicking the submit button, I am getting the following error
Invalid postback or callback argument.

Event validation is enabled using in configuration or 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.”

CAN SOME 1 TELL ME WHAT IS THE REASON. HOW TO RESOLVE THE PROBLEM

# re: EnableEventValidation error on button postback using a multipart form in .NET v2.0

left by sash at 12/18/2006 11:18 AM Gravatar
I had the same problem and i found it was because of multiple forms in my page (Don't ask me why!!). If i set EnableEventValidation="false" , i lost all the control values i had changed. I solved it by removing nested forms and having only one form element in the entire page.

# re: EnableEventValidation error on button postback using a multipart form in .NET v2.0

left by erollins at 1/11/2007 2:07 PM Gravatar
sash - I had used the EnableEventValidation="false" and moved on, only to find myself buried under new problems with control values too! I just dug in, found a nested form (modernizing old asp code) and voila, back on track.

Thanks so much!

# re: EnableEventValidation error on button postback using a multipart form in .NET v2.0

left by William at 8/22/2007 1:56 PM Gravatar
I had this same problem on a page for another project I was working on and it turned out to be a second form tag. There was already a form tag in the Master Page, but because you don't see the code for the master page when editing Content Pages, I added a form tag. (Still used to Dreamweaver). As soon as I removed the form tag from the Content Page (which wasn't needed anyway) this error went away and everything worked as expected.

# re: EnableEventValidation error on button postback using a multipart form in .NET v2.0

left by pedro at 1/9/2008 7:16 AM Gravatar
This error have to do with post back issues, so check your page load event. Is safe to use (!IsPostBack) in the page load to prevent invalid and unwanted postbacks

# re: EnableEventValidation error on button postback using a multipart form in .NET v2.0

left by nguyenngocviet at 2/18/2008 1:27 AM Gravatar
I tried
<%@ Page EnableEventValidation="false" %>
it worked!
You can try this.

# re: EnableEventValidation error on button postback using a multipart form in .NET v2.0

left by tyrus at 2/29/2008 11:54 AM Gravatar
I am seeing this error also. My situation seems to be a bit different. I have a dropdownlist that is populated after page_load via an Ajax call as the result of a selection in another dropdownlist. The error seems to be occuring because the values in the dropdownlist are not recognized when the page posts. I do not want to set EnableEventValidation=false. Anyone work througha similar situation or have any ideas?

# re: EnableEventValidation error on button postback using a multipart form in .NET v2.0

left by Somu at 3/24/2008 6:14 AM Gravatar
Its sad we still dont have a concrete solution for this

# re: EnableEventValidation error on button postback using a multipart form in .NET v2.0

left by laks at 5/5/2008 11:34 AM Gravatar
EnableEventValidation=false. removed my error, but
I have Web user control having updatable gridview on it
I used scriptManager and Updatepanel Ajax controls,

when click on "Edit button" on the grid view entire post back of the page is reloading which should not be happend.

The gridView should work with out page postbacks,

Any one please provide the solution asap...

# re: EnableEventValidation error on button postback using a multipart form in .NET v2.0

left by Andre at 11/13/2008 2:49 PM Gravatar
Hi Folks,

Jim, was right.
You have to check the html and javascript.
Try to use some simple html code like shown here below each page:
<html>
<head><title>test</title></head>
<body>this is a test</body></html>

Remove javascript if present and try again.
It works for me!

Thanks Jim

Regards,

André


# re: EnableEventValidation error on button postback using a multipart form in .NET v2.0

left by Vijaya at 11/21/2008 6:14 AM Gravatar
Hi,

We had two forms tags - one in master page and one in user control - because of which this error fired up..
Removing the second form tag, solved my problem.
Thanks for the resolution.....

# re: EnableEventValidation error on button postback using a multipart form in .NET v2.0

left by ac at 11/26/2008 3:38 AM Gravatar
will anybody please describe the use or the purpose of EnableEventValidation ?
If we know the use it, we can code accordingly.

# re: EnableEventValidation error on button postback using a multipart form in .NET v2.0

left by Hemnat at 12/19/2008 12:28 PM Gravatar
Hi Used
Page.ClientScript.RegisterForEventValidation()
to resolve it and it seems to be resolved.

# re: EnableEventValidation error on button postback using a multipart form in .NET v2.0

left by Som at 3/2/2009 5:15 PM Gravatar
Hi Hemnath,
Could you please tell me where did you call this to make it work.
Page.ClientScript.RegisterForEventValidation()

Our website users reports this error. But i am not able to reproduce it.

# re: EnableEventValidation error on button postback using a multipart form in .NET v2.0

left by agung at 3/5/2009 8:07 PM Gravatar
Vijaya, you right I face this problem too and removing
tag in usercontrol solve my problem.
but I still confuse now, cause in my development server
not raise error "EnableEventValidation error on button postback using a multipart form in .NET v2.0 " but error raise on deployment server(project use wss3)

# re: EnableEventValidation error on button postback using a multipart form in .NET v2.0

left by Anish at 3/11/2009 12:39 AM Gravatar
Hi
Thanks Jim..
Actually the HTML caused the problem..

# re: EnableEventValidation error on button postback using a multipart form in .NET v2.0

left by Minakshi at 5/31/2009 9:48 PM Gravatar
I am not having any nested form tags in my site and no databindings are there on page load
still i am getting the same error. What could be the reason

# re: EnableEventValidation error on button postback using a multipart form in .NET v2.0

left by Rohith at 7/30/2009 12:02 AM Gravatar
Hi
Thanks tyrus..
Actually, i am facing the same problem..

# re: EnableEventValidation error on button postback using a multipart form in .NET v2.0

left by Ashraf Bashir at 4/20/2010 9:00 AM Gravatar
Don't refresh the page by using response.redirect to the same page, just rebind data in gridview.
Post A Comment
Title:
Name:
Email:
Website:
Comment:
Verification: