/// <summary> /// Loads the group members drop down. /// </summary> /// <param name="ddlGroup">The DDL group.</param> /// <param name="groupId">The group identifier.</param> private void LoadGroupMembersDropDown(RockDropDownList ddlGroup) { var ddlGroupMember = ddlGroup.Parent.ControlsOfTypeRecursive <RockDropDownList>().FirstOrDefault(a => a.ID.StartsWith("ddlGroupMember_")) as RockDropDownList; if (ddlGroupMember != null) { int?groupId = ddlGroup.SelectedValue.AsIntegerOrNull(); ddlGroupMember.Items.Clear(); ddlGroupMember.Items.Add(new ListItem()); if (groupId.HasValue) { var groupMemberListItems = new GroupMemberService(new RockContext()).Queryable().Where(a => a.GroupId == groupId.Value) .OrderBy(a => a.Person.FirstName).ThenBy(a => a.Person.LastName) .Select(a => new { a.Id, a.Person.SuffixValueId, a.Person.NickName, a.Person.LastName }).ToList().Select(a => new ListItem(Person.FormatFullName(a.NickName, a.LastName, a.SuffixValueId), a.Id.ToString())); ddlGroupMember.Items.AddRange(groupMemberListItems.ToArray()); } ddlGroupMember.Visible = groupId.HasValue; } }