protected void AtmAdd_Click(object sender, EventArgs e) { int billamnt = 0; if (AtmbillnameTxtbx.Text != null && AtmbillamntTxtbx.Text != null) { try { billamnt = Convert.ToInt32(AtmbillamntTxtbx.Text); } catch (FormatException) { ClientScript.RegisterStartupScript(this.GetType(), "myalert", "alert('" + "Please enter a valid bill amount." + "');", true); } db.AddAtmBill(new AtmChecklist(userName, AtmbillnameTxtbx.Text, billamnt)); refillAtmCheck(); Atmchkbx.Items.Add(" - " + AtmCheck[AtmCheck.Count - 1].billname + ": $" + AtmCheck[AtmCheck.Count - 1].billamount); Atmchkbx.Items[Atmchkbx.Items.Count - 1].Value = AtmCheck[AtmCheck.Count - 1].id.ToString(); AtmbillnameTxtbx.Text = ""; AtmbillamntTxtbx.Text = ""; } }