August 2018
Intermediate to advanced
298 pages
5h 33m
English
Let's add a page-specific view. Before adding the view, we will need to add an action method in our HomeController file, from which we will call our page-specific view. Follow these steps to add a page-specific view:
public IActionResult Index2(){ ViewBag.Title = "This is Index2"; return View();}
ViewBag is used to pass information from the controller to the view. Here, we are passing the Title information from the action method to the view. Remember, ViewBag and ViewData are key value collections that you can fill from your controller and use from your view side. ViewBag is a dynamic object, whereas ViewData ...
Read now
Unlock full access