public void Execute(IMemberElement element)
 {
     var helper = new MemberBehaviorHelper<RequiredAttribute>();
     var attribute = helper.GetAttribute(element);
     if (attribute != null)
     {
         element.SetAttr("class", "req");
     }
 }
Exemplo n.º 2
0
        public void Execute(IMemberElement element)
        {
            var helper    = new MemberBehaviorHelper <RequiredAttribute>();
            var attribute = helper.GetAttribute(element);

            if (attribute != null)
            {
                element.SetAttr("class", "req");
            }
        }
        public void Execute(TextBox textBox)
        {
            var helper    = new MemberBehaviorHelper <StringLengthAttribute>();
            var attribute = helper.GetAttribute(textBox);

            if (attribute == null)
            {
                return;
            }

            textBox.MaxLength(attribute.MaximumLength);
        }
Exemplo n.º 4
0
        public void Execute(IMemberElement behavee)
        {
            var helper    = new MemberBehaviorHelper <RequiredAttribute>();
            var attribute = helper.GetAttribute(behavee);

            if (attribute != null)
            {
                var data = new Dictionary <string, bool> {
                    { "required", true }
                };
                BehaviorHelper.AddDataToClass(behavee, data);
            }
        }
        public void Execute(IMemberElement element)
        {
            var helper = new MemberBehaviorHelper<RangeAttribute>();
            var attribute = helper.GetAttribute(element);

            if (attribute == null)
            {
                return;
            }

            if (element is ISupportsMaxLength)
            {
                element.SetAttr(HtmlAttribute.MaxLength, attribute.Maximum);
            }
        }
Exemplo n.º 6
0
        public void Execute(IMemberElement element)
        {
            var helper    = new MemberBehaviorHelper <RangeAttribute>();
            var attribute = helper.GetAttribute(element);

            if (attribute == null)
            {
                return;
            }

            if (element is ISupportsMaxLength)
            {
                element.SetAttr(HtmlAttribute.MaxLength, attribute.Maximum);
            }
        }
Exemplo n.º 7
0
        /// <summary>
        /// This behavior affects elements bound to model properties having the Range attribute.  It adds Json data
        /// to the element's attribute incdicating the maximum and minimum values for the field.
        /// </summary>
        public void Execute(IMemberElement behavee)
        {
            var memberBehaviorHelper = new MemberBehaviorHelper <RangeAttribute>();
            var attribute            = memberBehaviorHelper.GetAttribute(behavee);

            if (attribute != null)
            {
                var data = new Dictionary <string, object>
                {
                    { "maximum", attribute.Maximum },
                    { "minimum", attribute.Minimum }
                };
                BehaviorHelper.AddDataToClass(behavee, data);
            }
        }