/// <summary>
        /// A validator for the display name is created.
        /// </summary>
        /// <param name="isReadOnly">
        /// This flag is initialized with the value of <see cref="BusinessObjectBoundEditableWebControl.IsReadOnly"/>.
        /// Implemantations should consider whether they require a validator also when the control is rendered as read-only.
        /// </param>
        /// <returns>An enumeration of all applicable validators.</returns>
        /// <remarks>
        ///   Generates a <see cref="BocAutoCompleteReferenceValueInvalidDisplayNameValidator"/> checking that the display name can be resolved
        /// to a valid object reference.
        /// </remarks>
        /// <seealso cref="BusinessObjectBoundEditableWebControl.CreateValidators()">BusinessObjectBoundEditableWebControl.CreateValidators()</seealso>
        protected override IEnumerable <BaseValidator> CreateValidators(bool isReadOnly)
        {
            _invalidDisplayNameValidator = null;

            var baseValidators = base.CreateValidators(isReadOnly);

            if (isReadOnly)
            {
                return(baseValidators);
            }

            _invalidDisplayNameValidator = CreateInvalidDisplayNameValidator();
            return(baseValidators.Concat(_invalidDisplayNameValidator));
        }
        private BocAutoCompleteReferenceValueInvalidDisplayNameValidator CreateInvalidDisplayNameValidator()
        {
            var invalidDisplayNameValidator = new BocAutoCompleteReferenceValueInvalidDisplayNameValidator();

            invalidDisplayNameValidator.ID = ID + "_ValidatorValidDisplayName";
            invalidDisplayNameValidator.ControlToValidate = ID;
            if (string.IsNullOrEmpty(InvalidItemErrorMessage))
            {
                invalidDisplayNameValidator.ErrorMessage = GetResourceManager().GetString(ResourceIdentifier.InvalidItemErrorMessage);
            }
            else
            {
                invalidDisplayNameValidator.ErrorMessage = InvalidItemErrorMessage;
            }
            return(invalidDisplayNameValidator);
        }