Error

The errors show that view detail was not found in the View folder.

From errors that being displayed, we can see where MVC is looking for our view. They are ComicBooks and Shared folder.

By convention, all of our views are kept in the Views folder and have Detail() function.

Views can be written in variety of languages. We are going to use Razor, a combination of C# and HTML, which has an extension called .cshtml.

Let's do it:

  1. Right-click at View folder > Add > New Folder > ComicBooks.
  2. Right-click at ComicBooks folder > Add > MVC 5 View Page (Razor).
  3. Name it with "Detail"
  4. Add <h1> tag in our HTML with "Hello from View".

It will be directed automatically because Visual Studio assumed that we want to show our contents from View folder.

results matching ""

    No results matching ""