protected void btnAdd_Click(object sender, EventArgs e) { lblExists.Visible = false; if (cust == null) { lblExists.Text = "Please select a customer!"; lblExists.Visible = true; } else { //Substituting custom indexer with exists method //if (custlist[cust.custID] == null) <--using custom indexer if (!custlistalt.Check(cust)) { custlistalt += (cust); Response.Redirect(@"~/Home/Admin/ContactDisplay.aspx"); } else { lblExists.Visible = true; lblExists.Text = "Customer is already selected! Please choose another!"; } } }
protected void Page_Load(object sender, EventArgs e) { //custlist = CustomerList.GetCustomers(); custlistalt = CustomerListAlternative.GetCustomers(); if (custlistalt != null) { custlistalt.DisplayContact(lstContacts); } }
protected void btnRemove_Click(object sender, EventArgs e) { int[] a; a = lstContacts.GetSelectedIndices(); for (int i = 0; i < a.Length; i++) { custlistalt -= (a[i] - i); } lstContacts.Items.Clear(); custlistalt.DisplayContact(lstContacts); }
protected void Page_Load(object sender, EventArgs e) { this.GetCustomer(); //custlist = CustomerList.GetCustomers(); commented out to try alt list custlistalt = CustomerListAlternative.GetCustomers(); //if (!IsPostBack) //{ // ddlCustomer.AppendDataBoundItems = true; // ddlCustomer.Items.Insert(0, new ListItem(String.Empty, String.Empty)); // ddlCustomer.SelectedIndex = 0; //} }