Button inside a repeater is not functioning

asp.net, c#, repeater

Solution

I was able to solve it by using, UseSubmitBehavior="false", property in the buttons.

Here is it:

<asp:Button ID="Button2" UseSubmitBehavior="false" runat="server" Text="Absent"  CommandName="test2" CommandArgument='<%# Eval("ID") %>' />

Problem

I have two buttons inside of the repeater and I'm trying to access them from code behind, but they are not working. I receive the following error: 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. I don't understand what does the error mean nor where is coming from. Here is my code: ``` <asp:Repeater ID="Repeater1" runat="server" onitemdatabound="Repeater1_ItemDataBound1" onitemcommand="Repeater1_ItemCommand" > <ItemTemplate> <table> <tr> <td><asp:Image ID="Image1" runat="server" /></td> <td><asp:Label ID="empnamelbl" runat="server" Text='<%# Eval("fullname") %>'></asp:Label></td> <td><asp:DropDownList ID="DropDownList1" runat="server"> </asp:DropDownList></td> <td> <asp:Button ID="Button1" runat="server" Text="Present" CommandName="test1" CommandArgument='<%# Eval("ID") %>' /> </td> <td><asp:Button ID="Button2" runat="server" Text="Absent" CommandName="test2" CommandArgument='<%# Eval("ID") %>' /> </td> </tr> </table> </ItemTemplate> </asp:Repeater> ``` Code behind: ``` protected void Repeater1_ItemCommand(object source, RepeaterCommandEventArgs e) { if (e.CommandName == "test1") { Response.Write("hi"); } } ```

Original source