private void loadDDLs(List <string> whereClause) { string predicate; //bool activeEmployeeFilter = cbActiveEmployee.Checked; //if (whereClause.Contains("ActiveEmployeeFilter")) //{ // int i = whereClause.LastIndexOf("ActiveEmployeeFilter"); // activeEmployeeFilter = true; // whereClause.RemoveAt(i); //} if (whereClause.Count < 1) { whereClause.Add("null"); predicate = "Employee != @0"; } else { predicate = whereClause[whereClause.Count - 1]; whereClause.RemoveAt(whereClause.Count - 1); } using (WACDataClassesDataContext wac = new WACDataClassesDataContext()) { //IQueryable a; //if (activeEmployeeFilter) // a = wac.vw_participantWACs.Where(w => w.start_date.HasValue && !w.finish_date.HasValue); //else // a = wac.vw_participantWACs; IQueryable q; try { q = wac.vw_participantWACs.Select(selectString).Where(predicate, whereClause.ToArray <string>()); } catch { q = wac.vw_participantWACs.Select(selectString).Where("Employee != null"); } List <DropDownList> ddls = new List <DropDownList>(); WACGlobal_Methods.GetControlListAll <DropDownList>(upHR_WACEmployeeFilter.Controls, ddls); foreach (DropDownList d in ddls) { populateDDL(d, q); setFilter(d); } //if (activeEmployeeFilter) // filters.Add("ActiveEmployeeFilter",null); } }