I have a View which is the container for a PartialView. Let's say a Customer - Orders relation. The View should received a CustomerViewModel
whereas the PartialView a collection of Orders, such as IEnumerable<OrderViewModel>
.
I basically have two ways of doing this (not to mention Angular), either Razor or jQuery. With Razor was pretty straightforward by utilizing @Html.Partial("_CustomerOrdersPartial", Model.Orders)
. But let's assume I cannot use Razor syntax and here it is how I ended up posting this question. I have read many posts on this matter but, most of them (not to mention all), suggest to use $("#container").load('@Url.Action("ActionName", new { parameterX = valueY }))
. Then here are my questions:
- Why to mix Razor and jQuery?
- Is this the only way?
- Is there any way to call the View and pass the model?
The last question has to do with the fact that the above code requires an action on the server-side to be called, whereas the @Html.Partial("_CustomerOrdersPartial", Model.Orders)
mentioned above will just call the View (client-side) and send the given Model in.
Any idea on how to solve this would be really helpful.
Thanks in advance for your time and thoughts.