C# – How to use button in repeater control

asp.netcrepeater

I am using asp.net 3.5 with c#.I want to invoke button click event inside repeater control.

<asp:Repeater ID="rptFriendsList"
    runat="server" 
    onitemcommand="rptFriendsList_ItemCommand">
    <ItemTemplate> 
        <asp:ImageButton ID="btnSave"
                         runat="server" 
                         ImageUrl="~/Contents/Images/save_button.png"
                         CommandName="Schedule"
                         UseSubmitBehavior="False"  />
    </ItemTemplate>
</asp:Repeater>

but when i click to a button its giving an 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."

my purpose is to execute some code in button click which is placed inside the repeater.Please help me to solve this issue.Thanks in advance.

Best Answer

UseSubmitBehavior="False" this property you have used is not present with the image button have you over ridden imagebutton class and added this property.

Related Topic