protected override void OnInitialized() { if (FormGroup != null) { _inputNumber = FormGroup.InputComponentCount; Id = FormGroup.Id + "-input-" + _inputNumber; FormGroup.AddInputComponent(this); if (AutoLabel && String.IsNullOrEmpty(FormGroup.Label)) { try { var fieldProperty = this.FieldIdentifier.Model.GetType().GetProperty(this.FieldIdentifier.FieldName); var displayAttribute = fieldProperty.GetCustomAttribute <DisplayAttribute>(); var displayNameAttribute = fieldProperty.GetCustomAttribute <System.ComponentModel.DisplayNameAttribute>(); if (displayAttribute != null) { FormGroup.SetLabel(displayAttribute.GetName()); } else if (displayNameAttribute != null) { FormGroup.SetLabel(displayNameAttribute.DisplayName); } else { FormGroup.SetLabel(this.FieldIdentifier.FieldName); } } catch { } } if (AutoRequired) { try { var fieldProperty = this.FieldIdentifier.Model.GetType().GetProperty(this.FieldIdentifier.FieldName); var requiredAttribute = fieldProperty.GetCustomAttribute <RequiredAttribute>(); if (requiredAttribute != null) { FormGroup.SetRequired(true); } } catch { } } } base.OnInitialized(); }