c# - Remote validation with a select input in MVC CORE -


hy , thank taking time read question.

i'm working on mvc core website , i'm try add remote validation entity framework on select input.

unfortunately seems doesn't work... here 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 in advance help.

i believe have arguments backwards. it's trying call action named verifynameservice on controller named parameter.

here constructors remoteattribute in core:

public remoteattribute(string routename); public remoteattribute(string action, string controller); public remoteattribute(string action, string controller, string areaname); 

Comments

Popular posts from this blog

networking - Vagrant-provisioned VirtualBox VM is not reachable from Ubuntu host -

c# - ASP.NET Core - There is already an object named 'AspNetRoles' in the database -

ruby on rails - ArgumentError: Missing host to link to! Please provide the :host parameter, set default_url_options[:host], or set :only_path to true -