<ItemTemplate>
<asp:ImageButton ID="imgbtnDelete" runat="server" ImageUrl="~/images/delete.png" CommandName="Cancel" />
</ItemTemplate>
As you are using
ImageButton
and you have a
CommandName
, so you should handle the
GridView.RowCommand
Event[
^].
For that declare
OnRowCommand
in
GridView
Markup.
<asp:GridView ID="GridView2" runat="server" AutoGenerateColumns="false" Width="200" GridLines="None" OnRowCancelingEdit="GridView2_RowCancelingEdit" OnRowCommand="GridView2_RowCommand" >
Then define the Event on Code Behind like...
protected void GridView2_RowCommand(Object sender, GridViewCommandEventArgs e)
{
if(e.CommandName == "Cancel")
{
}
}