public List <ComboBoxPair> GetMarketingSourceByPrefixText(string prefixText) { var otherDal = new OtherDAL(); return(otherDal.GetMarketingSource(string.Empty, 3).Where(eMarketingSource => eMarketingSource.Label.ToLower().Contains(prefixText.ToLower())).Select(marketingSource => new ComboBoxPair() { text = marketingSource.Label, value = marketingSource.MarketingSourceID.ToString() }).ToList()); }
/// <summary> /// this method fills the datagrid with relevant information /// about the MarketingSources. /// </summary> private void GetSource() { OtherDAL otherDal = new OtherDAL(); EMarketingSource[] objMarketing = otherDal.GetMarketingSource(string.Empty, 0).ToArray(); DataTable dtMarketingSource = new DataTable(); dtMarketingSource.Columns.Add("MarketingSourceID"); dtMarketingSource.Columns.Add("Source"); dtMarketingSource.Columns.Add("notes"); dtMarketingSource.Columns.Add("Active"); if (objMarketing.Length > 0 && objMarketing.Length > 0) { for (int icount = 0; icount < objMarketing.Length; icount++) { if (objMarketing[icount].IsActive.ToString().Equals("True")) { dtMarketingSource.Rows.Add(new object[] { objMarketing[icount].MarketingSourceID, objMarketing[icount].Label, objMarketing[icount].Notes, "Active" }); } else { dtMarketingSource.Rows.Add(new object[] { objMarketing[icount].MarketingSourceID, objMarketing[icount].Label, objMarketing[icount].Notes, "Deactivated" }); } } grdMarketingSource.DataSource = dtMarketingSource; ViewState["DSGRID"] = dtMarketingSource; grdMarketingSource.DataBind(); txtName.Text = ""; txtNotes.Text = ""; hfMarketingSourceID.Value = ""; grdMarketingSource.Visible = true; btnActivate.Enabled = true; btnDeActivate.Enabled = true; btnDelete.Enabled = true; } else { divErrorMsg.Visible = true; divErrorMsg.InnerText = "No Records Found"; //ClientScript.RegisterStartupScript(typeof(string), "jscode", "DisableAll();", true); btnActivate.Enabled = false; btnDeActivate.Enabled = false; btnDelete.Enabled = false; grdMarketingSource.Visible = false; } }