I have a partial view that I want to basically "take care of itself" and not have to pass it a preloaded Model from my parent view other than a single ID.
My partial view would then take the ID and load the relevant data from a db using code in the controller and pass it back to its view to display it.
I think what you're looking for is RenderAction.
It's not built in as you'll need the futures.
Yes it's possible
Pass the id
<% Html.RenderPartial("MyPartial", ViewData.Model.Id); %>
Then you have to use ajax in your partial asking the controller for data see:
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.