31

I need to validate the duplicate of FirstName, LastName and Email Address combination using remote validation in my ASP.NET MVC 4 (C#) application. The Remote Validation accepts only one AdditionalFields, which is as below:

 [Remote("IsUserNameAvailable", "User", AdditionalFields="LastName" )]
 public string FirstName{ get; set; }
 public string LastName{ get; set; }
 public string EmailAddress{ get; set; }

How can i add the EmailAddress for the combination?

Prasad
  • 58,881
  • 64
  • 151
  • 199

1 Answers1

54

You could separate them by comma:

[Remote("IsUserNameAvailable", "User", AdditionalFields="LastName,EmailAddress" )]
Darin Dimitrov
  • 1,023,142
  • 271
  • 3,287
  • 2,928
  • 1
    N.B. If you want this to actually be revalidated when the additional fields change you will want to look at @Kiff's answer here http://stackoverflow.com/questions/10163683/remote-validation-mvc-3-0-multiple-fields-validation – MemeDeveloper Nov 22 '13 at 11:49