public static void CreateValidatorForMultiLineTextBox(DynamicColumnInstanceDto instance, Control editControlsPanel, string validationGroup)
 {
     RegularExpressionValidator validator = new RegularExpressionValidator();
     validator.ID = "RegularExpressionValidator" + Constants.DynamicColumnControlPrefix + instance.Id;
     validator.ValidationGroup = validationGroup;
     validator.ValidationExpression = "^(.|\n){0," + instance.DataSize.Value.ToString(CultureInfo.InvariantCulture) + "}$";
     validator.ErrorMessage = instance.FormLabel + " must be " + instance.DataSize.Value.ToString(CultureInfo.InvariantCulture) + " characters or less.";
     validator.Display = ValidatorDisplay.Dynamic;
     validator.ControlToValidate = Constants.DynamicColumnControlPrefix + instance.Name;
     validator.Text = _validationTextImage;
     editControlsPanel.Controls.Add(validator);
 }
        private List<Field> BuildFields(DynamicColumnInstanceDto dynamicColumnDto, bool newRecord)
        {
            var fields = new List<Field>();

            if (!newRecord)
            {
                fields.Add(new Field(_id, "Id", FieldTypes.Label, dynamicColumnDto.Id));
                fields.Add(new Field(_fieldName, "Field Name", FieldTypes.Label, dynamicColumnDto.Name, true));
            }
            else
            {
                fields.Add(new Field(_id, "Id", FieldTypes.Hidden, 0));
                fields.Add(new Field(_fieldName, "Field Name", FieldTypes.Text, dynamicColumnDto.Name, true));
            }

            fields.Add(new Field(_fieldLabel, "Field Label", FieldTypes.Text, dynamicColumnDto.FormLabel, true));
            fields.Add(new Field(_isRequired, "Is Required", FieldTypes.Checkbox, dynamicColumnDto.IsRequired));
            fields.Add(new Field(_dataType, "Data Type", FieldTypes.Dropdown, dynamicColumnDto.DataType)
            {
                Options = new List<KeyValuePair<object, object>>()
                {
                    new KeyValuePair<object,object>("nvarchar","Text"),
                    new KeyValuePair<object,object>("int","Number"),
                    new KeyValuePair<object,object>("datetime","Date"),
                    new KeyValuePair<object,object>("dropdown","Dropdown"),
                    new KeyValuePair<object,object>("contentEditor","Content Editor")
                },
                OnChangeCommand = "DataTypeChanged",
                IsDisabled = !newRecord
            });
            fields.Add(new Field(_maxSize, "Max Length", FieldTypes.Hidden, dynamicColumnDto.DataSize, true));
            fields.Add(new Field(_dropdownOptions, "Dropdown Options", FieldTypes.Hidden, dynamicColumnDto.DropDownValues, true));
            fields.Add(new Field(_isMultiLine, "Is Multiline", FieldTypes.Hidden, dynamicColumnDto.IsMultiline, true));

            fields = SetupFieldVisibility(fields);

            return fields;
        }