I have the following asp:Repeater:
<asp:Repeater runat="server" ID="rptResults">
    <ItemTemplate>
        <div class="FileFile Large pdf SearchResult">
            <a href='<%# DirectCast(Container.DataItem, FileFolder).Link %>' style="text-decoration:none">
                <%# DirectCast(Container.DataItem, FileFolder).BackgroundHTML%>
                <p style="float:left;line-height:32px;margin:0px"><%# DirectCast(Container.DataItem, FileFolder).Filename%></p>                                            
            </a>
            <p style="float:left;line-height:32px;margin:0px; margin-left:20px;">Path:  <%# DirectCast(Container.DataItem, FileFolder).Link%></p> 
            <asp:Button runat="server" ID="btnDeleteFile" Name="<%# DirectCast(Container.DataItem, FileFolder).Link%>" Text="Delete" Style="float:right;margin-top:8px;cursor:pointer;"/>
        </div>
    </ItemTemplate>
</asp:Repeater>
My problem is trying to set an OnCLick listener.
First I tried:
<asp:Button runat="server" OnClick="btnDeleteFile_Click" ID="btnDeleteFile" Name="<%# DirectCast(Container.DataItem, FileFolder).Link%>" Text="Delete" Style="float:right;margin-top:8px;cursor:pointer;"/>
and:
Protected Sub btnDeleteFile_Click(sender As Object, e As System.EventArgs)
    Response.Write("KDKDK")
    Response.End()
End Sub
But that caused Invalid postback or callback argument. 
Which I suspect is because I cannot set an OnCLick listener inside a repeater?
I then tried:
<asp:Button runat="server" ID="btnDeleteFile" Name="<%# DirectCast(Container.DataItem, FileFolder).Link%>" UseSubmitBehavior="false" Text="Delete" Style="float:right;margin-top:8px;cursor:pointer;"/>
and
Protected Sub rpt_ItemCommand(ByVal source As Object, ByVal e As System.Web.UI.WebControls.RepeaterCommandEventArgs) 
    If e.CommandName = "Save" Then
        'Save
    End If
End Sub
Which did not cause the postback error, but did not fire the event. I suspect this is because the listener had not been assigned to the button?
If I add a handles eg:
Protected Sub rpt_ItemCommand(ByVal source As Object, ByVal e As System.Web.UI.WebControls.RepeaterCommandEventArgs) Handles rpt.ItemCommand
Which gave the error:
Handles clause requires a WithEvents variable defined in the containing type or one of its base types.
But I cannot see how to assign a WithEvents variable, and I am not sure this will work inside a repeater.
I will not keep boring you with every last ting I have tried, but I have searched all I can but cannot find anything that shows me how to set this OnCLick event?
 
     
    