protected void bindDomains() { DataTable dtDomain = new DataTable(); if (ViewState["ListIds"] != null) { objListContactMaster = new ListContactMaster(ConnectionString); dtDomain = objListContactMaster.getSelectedListsDomains(ViewState["ListIds"].ToString()); } if (dtDomain.Rows.Count > 0) { ViewState["dtDomain"] = dtDomain; ChkDomain.DataSource = dtDomain; ChkDomain.DataTextField = "Domain"; ChkDomain.DataValueField = "Domain"; ChkDomain.DataBind(); } }
protected void lbtnSuppressDomain_Click(object sender, EventArgs e) { try { lblDMessage.Text = string.Empty; lblDMsgUP.Update(); ViewState["CCSDomainPageNumber"] = null; ViewState["CCSDomainPageCount"] = null; sbListIds = new StringBuilder(); for (int i = 0; i < lstBoxListNames.Items.Count; i++) { sbListIds.Append(string.Format("{0},", lstBoxListNames.Items[i].Value)); } if (sbListIds.ToString().EndsWith(",")) sbListIds.Remove(sbListIds.Length - 1, 1); ViewState["ListIds"] = sbListIds.ToString(); objListContactMaster = new ListContactMaster(ConnectionString); DataTable dtDomain = objListContactMaster.getSelectedListsDomains(sbListIds.ToString()); if (dtDomain.Rows.Count > 0) { ViewState["dtDomain"] = dtDomain; //First we are insert the Already selected domain names in ArrayList (Swaroop-Jan16-13) if (lstSuppressedDomain.Items.Count != 0 && ViewState["CCSelectedDomains"] == null) { foreach (ListItem item in lstSuppressedDomain.Items) { SelectedDomains.Add(item.Value); } } rememberSuppresseDomainSelection(); bindDomainNames(); populateSuppresseSelection(); //Write Jan10-13 (8-55PM) if (ViewState["dtDomain"] != null) { if (((DataTable)ViewState["dtDomain"]).Rows.Count.Equals(lstSuppressedDomain.Items.Count)) ChkSelectAllDomain.Checked = true; } if (ViewState["CCDomainSelectedAll"] != null) { populateSuppresseDomainSelectAllSelection(); if (ViewState["dtDomain"] != null) { if (((DataTable)ViewState["dtDomain"]).Rows.Count != ((ArrayList)ViewState["CCDomainSelectedAll"]).Count) ChkSelectAllDomain.Checked = false; } } ModalPopupExtenderShowContactsdomain.Show(); ModalPopupExtenderShowContactsdomain.Focus(); } else { ViewState["dtDomain"] = null; ScriptManager.RegisterStartupScript(Page, Page.GetType(), "Success", "alert('Please select Proper list.')", true); } } catch (Exception ex) { throw ex; } }