Saturday, 24 January 2009

Invalid Postback or Callback argument

I'm going to post this one, because it caused us a little bit of pain recently. The error itself, and one of the (seemingly common) causes are so disconnected from each other that it really can be quite baffling.


We had the following. This happened only in IE (Firefox coped fine), when a LinkButton was clicked in a .NET page.

Invalid postback or callback argument. Event validation is enabled using 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 this happens to you, the first thing you should check is simple.

Do you have more than one form in the page? Is one form nested inside the other?

That's what we had (DOH) - taking out the inner form, and all will be hunky dory.

Not that two forms is valid anyway - it was just a regular joe c*ck up - but nonetheless, I thought it was particularly unhelpful of .NET to spew out an irrelevant error!