protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e) { if (e.CommandName == "Delete") { // get the categoryID of the clicked row int leaveID = Convert.ToInt32(e.CommandArgument); lvDb.DeleteLeave(leaveID); Response.Redirect(Request.RawUrl); } }