ASP MVC: Custom Validation Attribute

前端 未结 7 918
说谎
说谎 2021-01-18 10:00

I\'m trying to write my own Custom Validation attribute but I\'m having some problems.

The attribute I\'m trying to write is that when a user logs in, the password w

7条回答
  •  孤街浪徒
    2021-01-18 10:24

    you need a STATIC method in your case: EXAMPLE:

            public static ValidationResult ValidateFrequency( double frequency, ValidationContext context )
        {
            if( context == null )
            {
                return ( ValidationResult.Success );
            }
      }
    

提交回复
热议问题