August 2018
Intermediate to advanced
298 pages
5h 33m
English
Scenario
You've created a layout for your website. You're required now to create another layout and change the view to that layout by your company.
Aim
To create another layout and then dynamically change the view to that layout when we hit our action method.
Steps for completion
public IActionResult Index(){ var view = View(); view.ViewData["Layout"] = "~/Views/Shared/_Another.cshtml"; return view;}
@{ Layout = (string)ViewData["Layout"] ?? "_Layout";}
We have ...
Read now
Unlock full access