I'm having trouble with a Repeater in the webform, where the OnItemCommand event is not working. It should be triggered when I click the linkbutton.
Aspx code:
<asp:Repeater ID="repeaterImagens" runat="server"
OnItemCommand="repeaterImagens_ItemCommand"
OnItemDataBound="repeaterImagens_ItemDataBound">
<ItemTemplate>
...
<asp:LinkButton ID="lbExcluir" runat="server"
CommandName="excluir"
CommandArgument="<%# ((String)Container.DataItem) %>"
OnClientClick="if (!confirm('Confirma a exclusão desta imagem?'));">
</asp:LinkButton>
</ItemTemplate>
</asp:Repeater>
Code behind C #
protected void repeaterImagens_ItemCommand(object source, RepeaterCommandEventArgs e)
{
if (e.CommandName.Equals("excluir"))
{
ExcluirArquivo(e.CommandArgument.ToString());
}
}
I tested in debug mode, clicking on Linkbutto nothing happens, nor does it call the ItemCommand event.