public string GetProgramList(string residential) { SqlDataReader dataReader = null; DataTable dataTable = new DataTable(); string html = ""; string condition = "1"; try { if (residential != "") { condition = " residential_program = '" + residential + "'"; } var CL = new commonLogic(); SqlConnection cnn = CL.connect(); SqlCommand command; String sql = ""; sql = "select DISTINCT program_name FROM programs WHERE " + condition; command = new SqlCommand(sql, cnn); dataReader = command.ExecuteReader(); if (dataReader.HasRows) { dataTable.Load(dataReader); CL.ddData = dataTable; CL.val = "program_name"; CL.text = "program_name"; CL.selectedVal = ""; html = CL.createDropDown(); return(html); } else { return(html); //No data } } catch (Exception e) { return(html); } }