4

strong textCan I use attribute compare for the property. If property which I need for compare is in another class? I need something like this:

public class TestViewModel 
{
    public User UserProfile { get;set;}

    [Compare("UserProfile.Password")
    public string ConfirmPassword { get;set;}
}

Maybe exist another solution how to do this, without js.

UPD: Resolve it like this, not what I want, maybe good solution take fields which are needed to abstract class or interface and create inheritance. Because not all the fields from the user require..

public class TestViewModel : User 
{
    [Compare("Password")
    public string ConfirmPassword { get;set;}        
}
ivamax9
  • 2,601
  • 24
  • 33

0 Answers0