Articles → ASP .NET MVC → Strongly Type Views In Mvc
Strongly Type Views In Mvc
Strongly Type View
How To Create A Strongly Type View
- Right click on the View → Home folder and click on Add → view..
Click to Enlarge
- A pop up window appears. From the window, select ‘Empty’ from ‘Template’ drop down
Click to Enlarge
- Once you select the option, ‘Model’ drop down gets enabled (see the following figure)
Click to Enlarge
- Select the model and click on ‘Add’.
@model strongly_type_views.Models.MyModel
@{
ViewBag.Title = "View2";
Layout = "~/Views/Shared/_Layout.cshtml";
}
<h2>View2</h2>
Advantages Of Strongly Type View
- In visual studio, you get an advantage of intellisense.
- Errors could be checked at compile time.