/// <summary>
        /// Creates the control(s) necessary for prompting user for a new value
        /// </summary>
        /// <param name="configurationValues">The configuration values.</param>
        /// <param name="id"></param>
        /// <returns>
        /// The control
        /// </returns>
        public override Control EditControl(Dictionary <string, ConfigurationValue> configurationValues, string id)
        {
            ListControl editControl;

            var values = DocumentTypeCache.All().Select(v => new { v.Id, v.Name }).OrderBy(v => v.Name).ToList();

            var allowMultiple = true;

            if (configurationValues != null &&
                configurationValues.ContainsKey(ALLOW_MULTIPLE_KEY))
            {
                allowMultiple = configurationValues[ALLOW_MULTIPLE_KEY].Value.AsBoolean(true);
            }

            if (!allowMultiple)
            {
                // Select single member
                editControl = new RockDropDownList {
                    ID = id
                };
            }
            else
            {
                // Select multiple members
                editControl = new RockListBox {
                    ID = id, DisplayDropAsAbsolute = true
                };
            }

            var items = new List <ListItem>();

            foreach (var value in values)
            {
                items.Add(new ListItem(value.Name, value.Id.ToString()));
            }

            if (items.Count > 0)
            {
                if (editControl is RockListBox)
                {
                    (editControl as RockListBox).Items.AddRange(items.ToArray());
                }
                else
                {
                    (editControl as RockDropDownList).Items.AddRange(items.ToArray());
                }

                return(editControl);
            }

            return(null);
        }
        /// <summary>
        /// Returns the field's current value(s)
        /// </summary>
        /// <param name="parentControl">The parent control.</param>
        /// <param name="value">Information about the value</param>
        /// <param name="configurationValues">The configuration values.</param>
        /// <param name="condensed">Flag indicating if the value should be condensed (i.e. for use in a grid column)</param>
        /// <returns></returns>
        public override string FormatValue(System.Web.UI.Control parentControl, string value, Dictionary <string, ConfigurationValue> configurationValues, bool condensed)
        {
            if (string.IsNullOrWhiteSpace(value))
            {
                return(base.FormatValue(parentControl, value, configurationValues, condensed));
            }

            // This is a list of IDs, we'll want it to be document type names instead
            var selectedValues = value.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries).Select(int.Parse).ToList();

            return(DocumentTypeCache.All()
                   .Where(v => selectedValues.Contains(v.Id))
                   .Select(v => v.Name)
                   .ToList()
                   .AsDelimited(", "));;
        }
        /// <summary>
        /// Creates the control(s) necessary for prompting user for a new value
        /// </summary>
        /// <param name="configurationValues">The configuration values.</param>
        /// <param name="id"></param>
        /// <returns>
        /// The control
        /// </returns>
        public override Control EditControl(Dictionary <string, ConfigurationValue> configurationValues, string id)
        {
            RockListBox editControl = new RockListBox {
                ID = id, DisplayDropAsAbsolute = true
            };

            var values = DocumentTypeCache.All().Select(v => new { v.Id, v.Name }).OrderBy(v => v.Name).ToList();

            foreach (var value in values)
            {
                editControl.Items.Add(new ListItem(value.Name, value.Id.ToString()));
            }

            if (editControl.Items.Count > 0)
            {
                return(editControl);
            }

            return(null);
        }