Tim Huffam

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

  Home  |   Contact  |   Syndication    |   Login
  153 Posts | 0 Stories | 2415 Comments | 653 Trackbacks

News

Archives

Post Categories

Interesting Blogs/Links

Wednesday, October 29, 2008 #

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";