Context: Building a web app using ASP.NET MVC 5 with EF 6.1.3 linked to an SQL Server database.
I have a pre-loaded form which I am trying to dynamically populate based on a drop down list (in this case it is car registrations). Ideally, upon selection an Ajax request is made which would return a model object which I could then link with the pre loaded form entries. The form entries are of type:
@Html.LabelFor(m => m.VehicleInformation.PreviousOwners, new { @class = "col-md-3" })
@Html.TextBoxFor(m => m.VehicleInformation.PreviousOwners, new { @class = "form-control", id = "PreviousOwners#" })
@Html.ValidationMessageFor(m => m.VehicleInformation.PreviousOwners)
Is there an ASP.NET specific solution to this? I have explored the below two options, the Json solution is clunky for large forms and the PartialView method doesn't make use of the pre-rendered form:
1) Returning a Json object and jquerying data into the form;
2) Loading a partial view with the returned model object.