GetValidationProperty() public static method

public static GetValidationProperty ( object o ) : PropertyDescriptor
o object
return PropertyDescriptor
示例#1
0
        protected string GetControlValidationValue(string name)
        {
            Control control = NamingContainer.FindControl(name);

            if (control == null)
            {
                return(null);
            }

            PropertyDescriptor prop = BaseValidator.GetValidationProperty(control);

            if (prop == null)
            {
                return(null);
            }

            object o = prop.GetValue(control);

            if (o == null)
            {
                return(String.Empty);
            }

            if (o is ListItem)
            {
                return(((ListItem)o).Value);
            }

            return(o.ToString());
        }
示例#2
0
        protected void CheckControlValidationProperty(string name, string propertyName)
        {
            Control            control = NamingContainer.FindControl(name);
            PropertyDescriptor prop    = null;

            if (control == null)
            {
                throw new HttpException(String.Format("Unable to find control id '{0}'.", name));
            }

            prop = BaseValidator.GetValidationProperty(control);
            if (prop == null)
            {
                throw new HttpException(String.Format("Unable to find ValidationProperty attribute '{0}' on control '{1}'", propertyName, name));
            }
        }
 bool FilterControl(Control control)
 {
     return(BaseValidator.GetValidationProperty(control) != null);
 }