Bentopher
Bentopher
CC#
Created by Bentopher on 2/10/2025 in #help
Dynamic header in _Layout
Hi there, I'm trying to get my head around how to dynamically change my nav header in the _layout.cshtml file. I want to add a new section to it if a user is in a specific zone. Then this section will use some data I pass in to create itself in the header. Does this mean that I need to pass in a model with the zone and data into the layout? Given that the layout is used on all pages will this be an issue if I don't pass in this model? I understand how passing models to different views works it's the fact that the layout is used in all views basically that has me confused on what way to do this.
9 replies