/** Method updates staff members drop down list */ private void updateStaffMembersList() { staffMemberList.Clear(); staffMemberList.Add(new ListItem { text = "Select a doctor", id = 0 }); if (!doctorCheck.Checked) { return; } int found = -1; List <IModel> staffMembers = getStaffMembers(); for (int i = 0; i < staffMembers.Count; i++) { StaffModel doctor = (StaffModel)staffMembers[i]; staffMemberList.Add(new ListItem { text = doctor.getFullStaffName(), id = doctor.getStaffId() }); if (selectedDoctor == doctor.getStaffId()) { found = i + 1; } } staffMemberDropDown.SelectedIndex = found == -1 ? 0 : found; }