I have a model:
public class MyModel ...fields [Remote(ActionName, ControllerName)] public string SomeNumber { get; set; } ..fields
And do the action in ControllerName:
public JsonResult ActionName(string someNumber) {...}
But when the action is called, the someNumber parameter is always null. And when I try to debug it, I get
GET /ControllerName/ActionName?MyModel.SomeNumber =34189736
How can I make it work? (I cannot pass the entire MyModel model and cannot change the name of the MyModel.SomeNumber field in my view)
UPD Input in my opinion:
<input data-val="true" data-val-remote-additionalfields="*.SomeNumber" data-val-remote-url="/ControllerName/ActionName" id="MyModel_SomeNumber" name="MyModel.SomeNumber" type="text" value="34189734" class="valid">
UPD solved! :) I am creating a new model with one SomeNumber field and a prefix of use:
SomeNumber([Bind(Prefix = "MyModel")]MySingleFieldModel model)
source share