protected void lbtnYes_Click(object sender, EventArgs e) { try { hdnSearchValue.Value = txtsearch.Text; if (grdContacts.Rows.Count > 0) { lblMsg.Text = string.Empty; //Get contact Selection rememberContactSelection("chkSelect", "lblId", grdContacts, "chkHdr"); if (Session["SASelectedContacts"] != null) { StringBuilder strbDeletedContacts = new StringBuilder(); //adding selected contatIds to stringbuilder for (int i = 0; i < contactsSelected.Count; i++) { strbDeletedContacts.Append(contactsSelected[i] + ", "); } strbDeletedContacts.Remove(strbDeletedContacts.Length - 2, 1); SuppressContactsBase SupContact = new SuppressContactsBase(ConnectionString); SupContact.RemoveMultipleContacts(strbDeletedContacts.ToString()); Session["SASelectedContacts"] = null; hdrchkselected.Clear(); hdContacts.Value = ""; if (RBGlobal.Checked == true) { lstBoxListNames.Style.Add("display", "none"); lbtnLookup.Style.Add("display", "none"); lbllists.Style.Add("display", "none"); } else { lstBoxListNames.Style.Add("display", "Block"); lbtnLookup.Style.Add("display", "Block"); lbllists.Style.Add("display", "Block"); } searchselect(); UpdatePanel1.Update(); lblGrdMsg.Text = "Contact(s) removed successfully from suppression with ids: " + strbDeletedContacts.ToString(); Session["SASelectedContacts"] = null; txtsearch.Text = hdnSearchValue.Value; } } } catch (Exception ex) { lblGrdMsg.Style.Add("color", "red"); lblGrdMsg.Text = ex.Message; throw ex; } }
protected void lbtnYesAll_Click(object sender, EventArgs e) { if (grdContacts.Rows.Count > 0) { StringBuilder strbDeletedContacts = new StringBuilder(); DataTable dtsuppressContacts = SuppressContactsBase.SelectAll(ConnectionString); //adding selected contatIds to stringbuilder for (int i = 0; i < dtsuppressContacts.Rows.Count; i++) { strbDeletedContacts.Append(dtsuppressContacts.Rows[i][0] + ", "); } strbDeletedContacts.Remove(strbDeletedContacts.Length - 2, 1); SuppressContactsBase SupContact = new SuppressContactsBase(ConnectionString); SupContact.RemoveMultipleContacts(strbDeletedContacts.ToString()); Session["SASelectedContacts"] = null; hdrchkselected.Clear(); hdContacts.Value = ""; if (RBGlobal.Checked == true) { lstBoxListNames.Style.Add("display", "none"); lbtnLookup.Style.Add("display", "none"); lbllists.Style.Add("display", "none"); } else { lstBoxListNames.Style.Add("display", "Block"); lbtnLookup.Style.Add("display", "Block"); lbllists.Style.Add("display", "Block"); } searchselect(); UpdatePanel1.Update(); txtsearch.Text = ""; lblGrdMsg.Text = "All Contacts removed successfully from suppression"; Session["SASelectedContacts"] = null; txtsearch.Text = hdnSearchValue.Value; } }