I wonder if it’s possible to wrap dynamically add layout to partial views based on routing.
For example:
- http://my.app.com/Controller/GetForm – returns a partial view
- http://my.app.com/Test/Controller/GetForm – returns the same partial view, but wrapped in _Layout.cshtml
The point here is that I don’t want to create another view with duplicate functionality, but rather set Layout property dynamically.
Thanks.
Try this:
Action
Markup
Routing config
Or just