protected void Clear_Click(object sender, EventArgs e) { ISBN.Text = ""; Name.Text = ""; PurchaseCost.Text = ""; SellingPrice.Text = ""; Message.Text = "Cleared!"; BookListDisplay.DataSource = null; BookListDisplay.DataBind(); }
protected void Add_Click(object sender, EventArgs e) { string isbn = ISBN.Text; string name = Name.Text; double cost = double.Parse(PurchaseCost.Text); double price = double.Parse(SellingPrice.Text); //if(bookInfo.Contains(isbn)) //{ // Message.Text = "This book is already registered! Please pick a different ISBN."; //} //else //{ bookInfo.Add(new Books(isbn, name, cost, price)); Message.Text = "Your book has been registered!"; //} BookListDisplay.DataSource = bookInfo; BookListDisplay.DataBind(); }