Asp DotNet MVC Tutorial For Beginner Introduction Part 2
Adding Views To Projects
1. Open the Microsoft visual studio.Click on view in the solution explorer at the right side of the page. We can see the views that are created by default.
2. First of all, we can create a view by simply right click on the ActionResult name.This is the simplest method to create the same.
3. In order to add a view , click on the 'shared' option then click on 'Add' and from that click on 'view'
4. Specify the name of the view to add and then continue by clicking on the 'Add' button.
Creation Of View In Cshtml File1. Then we can open the view that created and add contents to display in the browser. For example , I write code for displaying the first name,last name and a submit button.
2. Here we add the created view to the HomeController and after that the view works properly.For that we use an ActionResult method.Code will speicifed in the figure.
3. Save and run the program.Then we can see the output in browser window.
Like this we can add a view to project.