All about Programming and Sourcecode

How to Create a View in ASP.NET MVC ?

Every Web Applications needs to have the UI through which the user can interact with . You can easily create a View in ASP.NET MVC by following the below steps.

How to Create a View in ASP.NET MVC ?

1. Right Click on the Action Method in the Controller and click “Add View” in the context menu.

How to Create a View in ASP.NET MVC ?

How to Create a View in ASP.NET MVC ?

2. In the Add View Dialog , give a name for the View and select the View Engine that you wish to use for the current View from the View engine dropdown list. You can also select the layout or the master page for the View. If the view is a strongly typed view , you could select the Model Class and Scaffold template by checking the “Create a a strongly-typed view” and click “Add” button.

How to Create a View in ASP.NET MVC ?

How to Create a View in ASP.NET MVC ?

3. A new file with the specified name will now be added to the Views folder . You can start entering the markup for the UI in the view now .

Sample View

@{

ViewBag.Title = "Index";

}

<h2>AbundantCode.com</h2>

@Html.Label("AbundantCode.com - a Programming Directory")
0saves
If you enjoyed this post, please consider leaving a comment or subscribing to the RSS feed to have future articles delivered to your feed reader.
 
Comments

No comments yet.

Leave a Reply