Reputation: 1
Hy everyone and thank you for taking the time to read my question.
I'm working on a MVC CORE website and I'm try to add the remote validation with Entity Framework on a select input.
Unfortunately it seems to doesn't work... Here is my code :
HTML SELECT -->
<select asp-for="IDSociety" asp-items="@(new SelectList(@ViewBag.ListOfSociety,"ID", "Name"))"></select>
C# ViewModel -->
[Remote("VerifyNameService", "Parameter", AdditionalFields = "ServiceName", ErrorMessage = "Ce nom de service existe déjà pour cette société !")]
public int IDSociety { get; set; }
Thank you in advance for your help.
Upvotes: 0
Views: 332
Reputation: 10879
I believe that you have your arguments backwards. It's trying to call the action named VerifyNameService
on the controller named Parameter
.
Here are the constructors for the RemoteAttribute
in Core:
public RemoteAttribute(string routeName);
public RemoteAttribute(string action, string controller);
public RemoteAttribute(string action, string controller, string areaName);
Upvotes: 1