I want to call an action in the controller in the view and I have to send a series of values to the controller, but the action calls the controller but sends null values. please help me
Code in view:
var _getDocumentsUrl = '@Html.Raw(@Url.Action("GetDocuments", "Document", new { Section = "0", Province = "1", County = "0", District = "0", area = "Province" }))';
Action in Controller:
public IActionResult GetDocuments(AreaVM area)
{///codes////}
Model:
public class AreaVM
{
public string? Section { get; set; }
public string? Province { get; set; }
public string? County { get; set; }
public string? District { get; set; }
}
Sending the values of section = 0, Province = 1, County = 0, and District = 0 to the controller
My problem was solved by changing area to model in GetDocuments action
public IActionResult GetDocuments(AreaVM model)