protected void btnRemove_Click(object sender, CommandEventArgs e) { if (mCustomer != null) { if (e.CommandName.Equals("lbtnRemove")) { var mypet = (from p in mCustomer.MyPets where p.PetName.ToLower().Equals(e.CommandArgument.ToString().ToLower()) select p).FirstOrDefault(); if (mypet != null) { mCustomer.MyPets.Remove(mypet); bindPets(); DetermineButtonText(); try { using (PetfirstData pfData = new PetfirstData()) { pfData.RemovePet(mypet.PetId); } } catch (Exception ex) { LoggingError("Removing Pet", ex.ToString()); }//don't do anything if store data fails } } } }