Exemplo n.º 1
0
        /// <summary>
        /// Initializes the validation on the row.
        /// </summary>
        protected virtual void InitializeValidation(HtmlGenericControl row, HtmlGenericControl labelCell, HtmlGenericControl editorCell, IFormEditorProvider editorProvider, PropertyDisplayMetadata property, DynamicDataContext dynamicDataContext)
        {
            if (dynamicDataContext.ValidationMetadataProvider.GetAttributesForProperty(property.PropertyInfo).OfType <RequiredAttribute>().Any())
            {
                labelCell.Attributes["class"] += " dynamicdata-required";
            }

            if (editorProvider.CanValidate)
            {
                row.SetValue(Validator.ValueProperty, editorProvider.GetValidationValueBinding(property, dynamicDataContext));
            }
        }
        protected virtual void InitializeValidation(HtmlGenericControl formGroup, HtmlGenericControl labelElement, HtmlGenericControl controlElement, IFormEditorProvider editorProvider, PropertyDisplayMetadata property, DynamicDataContext dynamicDataContext)
        {
            if (dynamicDataContext.ValidationMetadataProvider.GetAttributesForProperty(property.PropertyInfo).OfType <RequiredAttribute>().Any())
            {
                labelElement.Attributes["class"] = ControlHelpers.ConcatCssClasses(labelElement.Attributes["class"] as string, "dynamicdata-required");
            }

            if (editorProvider.CanValidate)
            {
                controlElement.SetValue(Validator.ValueProperty, editorProvider.GetValidationValueBinding(property, dynamicDataContext));
            }
        }