Geeks With Blogs

Tim Huffam Dotting the I and crossing the T of I.T.

The following exception occurs in ASP.NET (version: 2.0.50727.1433) when you trigger an event on an ASP.Net object that has no ID set, eg clicking on a LinkButton:

System.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.

The fix for this is to simply make sure the object has an ID assigned to it eg:

 

LinkButton theButton = new LinkButton();
theButton.ID = "buttonID"; Posted on Wednesday, October 29, 2008 12:37 AM Off Topic , MySQL , Architecture, Design and Development | Back to top


Comments on this post: System.ArgumentException: Invalid postback or callback argument.

# re: System.ArgumentException: Invalid postback or callback argument.
Requesting Gravatar...
a great piece of code
Left by blood stain removal on Nov 22, 2011 8:16 AM

# re: System.ArgumentException: Invalid postback or callback argument.
Requesting Gravatar...
There's really no question that your particular webpage is merely engaged and as well brilliant to know this post.
Left by Android Instagram on Apr 11, 2012 4:05 AM

# re: System.ArgumentException: Invalid postback or callback argument.
Requesting Gravatar...
hmmm. that's what I was missing in my code. thanks for posting this. it worked perfectly.
Left by Omron Blood Pressure Monitors on Aug 30, 2012 9:31 PM

Your comment:
 (will show your gravatar)


Copyright © Tim Huffam | Powered by: GeeksWithBlogs.net