protected void btnSave_Click(object sender, EventArgs e) { Copy c = new Copy(); c.BookNumber = int.Parse(txtBookNum.Text); c.SequenceNumber = CopyDAO.GetSeqNumMaxOfBook(c.BookNumber) + 1; ///Set Type if (!(txtType.Text[0].Equals('A'))) { if (!(txtType.Text[0].Equals('R'))) { lblError.Text = "Type must be A or R"; lblError.Visible = true; return; } } c.Type = txtType.Text[0]; //Set Price if (txtPrice.Text == "") { c.Price = 0; } else { if (DAO.checkFloat(txtPrice.Text)) { c.Price = float.Parse(txtPrice.Text); } else { lblError.Text = "Price must in range 0-999.999.999"; lblError.Visible = true; return; } } if (check == 1) { CopyDAO.Insert(c); clear(); displayButtons(1); } if (check == 2) { c.CopyNumber = (int)Session["copyNumber"]; CopyDAO.Update(c); clear(); displayButtons(1); } ObjectDataSource1.Select(); GridView1.DataBind(); }