Is there a way to render inside my view of controller A a partial view from other controller B?
Edit: I wrote a partial view that is good for only two controllers and I don't want to copy it to their both Views folder.
I want The partial view to be displayed each time the View is rendered not after something happens.
To create a partial view, right click on the Shared folder -> click Add -> click View.. to open the Add View popup, as shown below. You can create a partial view in any View folder. However, it is recommended to create all your partial views in the Shared folder so that they can be used in multiple views.
To create a partial view, right-click on view -> shared folder and select Add -> View option. In this way we can add a partial view. It is not mandatory to create a partial view in a shared folder but a partial view is mostly used as a reusable component, it is a good practice to put it in the "shared" folder.
Html.Partial()
.Html.Action()
to invoke an action on a different controller and render the results within the current view.If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With