protected void gvCart_RowDeleting(object sender, GridViewDeleteEventArgs e) { //获取Id Label Label lblBookId = this.gvCart.Rows[e.RowIndex].FindControl("lblBookId") as Label; int bookId = Int32.Parse(lblBookId.Text); //更新购物车图书数量 if (Session["Cart"] != null) { CartInfo cart = (CartInfo)Session["Cart"]; CartManager.DeleteBook(cart, bookId); } BindCart(); }