protected void btnAddToCart_Click(object sender, EventArgs e) { Validate(); if (Page.IsValid) { Book book = BookCatalogDataAccess.GetABookById(BookList.SelectedValue); int quantity = Int16.Parse(txtQauntity.Text); BookOrder order = new BookOrder(book, quantity); cart.AddBookOrder(order); BookList.Items.RemoveAt(BookList.SelectedIndex); string amount = quantity > 1 ? "copies" : "copy"; lblDescription.Text = quantity + " " + amount + " of " + book.Title + " have been added to your cart"; btnViewCart.Text = "View Cart (" + cart.NumOfItems + " items)"; BookList.ClearSelection(); txtQauntity.Text = ""; } }