protected void gvBookList_RowDeleting(object sender, GridViewDeleteEventArgs e) { try { bookTable = (List <BookBO>)Session[Common.sessionBookList]; BookBL bookBL = new BookBL(); bookTable = bookBL.DeleteById(gvBookList.DataKeys[e.RowIndex].Values[0], bookTable); Session["BooksList"] = bookTable; FillGrid(); lblSuccessMessage.Text = Common.msgDeleteSuccess; } catch (Exception ex) { // log exception lblErrorMessage.Text = Common.msgDeleteFailure; } }