Write your code under
gv_allcontact_RowCommand event in gridview.
give
CommandName="imgBtn1" attribute in ASPX.
check following code.
protected void gv_allcontact_RowCommand(object sender, GridViewCommandEventArgs e)
{
if (e.CommandName == "imgBtn1")
Response.Write("imagebutton clicked");
}
Do not forget to write
!isPostBack in pageload. and bind your gridview under !isPostBack