It should be noted that some people have experienced problems with various controls causing 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.
For example, here are two types of button control on the same form. The ImageButton errors when clicked on (see error message above), but the LinkButton executes correctly:-
<asp:ImageButton
ID="MyImageButton"
runat="server"
ImageUrl="~/Images/MyImage.gif"
OnClick="btnButton_Click"
CommandName="MyCommand"/>
and
<asp:LinkButton
ID="MyLinkButton"
runat="server"
text="test"
OnClick="btnButton_Click"
CommandName="MyCommand"/>
N.B. Before you ask, the event handler looks like this (so it can handle either type of control):-
protectedvoid btnButton_Click(object source, EventArgs e)
{
}
Looks like MS cut some corners testing Event Validation.