private void BuildPatientList() { string dataset = CacheManager.GetDatasetSQL(Session[SessionKey.DatasetId]); int protocolId = int.Parse(BaseProtocolId); bool showIdentifiers = base.ShowPatientIdentifiers(); // get list bool canViewIdentifiers = base.ShowPatientIdentifiers(); DataTable patientsList = ProtocolMgmtDa.GetPatientsByProtocol(protocolId, dataset, showIdentifiers, true); DataView sortedPatients = PatientProtocolController.SortPatientsByStudyId(patientsList, "ASC"); var patients = from patient in sortedPatients.ToTable().AsEnumerable() let name = patient["Name"].ToString() select new { PatientDisplayName = patient[PatientProtocol.PtProtocolStudyId].ToString() + (canViewIdentifiers && !string.IsNullOrEmpty(name) ? " : " + name : ""), PatientProtocolId = patient[PatientProtocol.PatientProtocolId].ToString() }; PatientList.DataSource = patients; PatientList.DataBind(); }