Quantcast
Channel: ASP.NET Core
Viewing all articles
Browse latest Browse all 9386

Sharing HTML among views

$
0
0

Hi!

I am trying to share a piece of HTML (2nd level links) among views of one controller. I tried to put RenderSection in the _Layout.cshtml and then:

  1. @section HomeSection in _ViewStart.cshtml placed Views/Home, wasn't found
  2. @section HomeSection into _Layout.cshtml, wasn't found

Things that would probably work but I would prefer not to do:

  1. Duplicate the layout in _Layout file into multiple files with small tweaks and set the layout in Views/Home/_ViewStart.cshtml
  2. Use RenderPartial and create heap of separate files in Views/Shared, for every section shared
  3. Move one level up from Controller-View to Area-Controller with single action and section per view

What would be the correct approach?

Thanks,
Jan


Viewing all articles
Browse latest Browse all 9386

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>