Bootstrap FreeKB - MVC - Add a new page
MVC - Add a new page

Updated:   |  MVC articles

In this example, let's add a new page named FAQs under Home, so that we have a page such as http://www.example.com/Home/FAQs.

Controller

  1. In Solution Explorer, expand Controllers and select the HomeController.cs
  2. Add the following markup to the HomeController.cs file:
public ActionResult FAQs(){
     ViewBag.Message = "FAQs";
     return View();
}

View

  1. In Solution Explorer, expand View.
  2. Right-click on the Home folder and select Add > View
  3. Name the View FAQs and select Add

You can now publish the site, navigate to http://www.example.com/Home/FAQs, and your FAQs page should be displayed.

 

 




Did you find this article helpful?

If so, consider buying me a coffee over at Buy Me A Coffee



Comments


Add a Comment


Please enter 4141a7 in the box below so that we can be sure you are a human.