razor - How can I retrieve the the current CSHTML file for more intelligent view selection? -


suppose have partial view "_navbar.cshtml" in views/shared folder that's referenced in layout page... gets embedded on every page.

now, suppose have view same name existing in views/controllerx/partial folder, navigation bar specific view.

in case, views in other controllers find shared partial view file fine. however, when run view in controllerx, _navbar.cshtml file in views/controllerx/partial ends usurping/overriding 1 in shared/views.

so wondering if there's way prefer view based on executing cshtml file. example, if "partial" called cshtml file in shared folder, should prefer other partial views in same folder on ones in more specific controller view locations.

in short, there way rig view engine rather having static search path order, it's contextual , looks files in same folder executing cshtml file first?


Comments

Popular posts from this blog

python - No exponential form of the z-axis in matplotlib-3D-plots -

php - Best Light server (Linux + Web server + Database) for Raspberry Pi -

c# - "Newtonsoft.Json.JsonSerializationException unable to find constructor to use for types" error when deserializing class -