ASP.NET MVC > Views - Razor Engine

Model based Razor view in ASP.NET MVC

How to create a model based view?


To create a model based view, we declare model for the View at the top of the page by using @model directive. 

@model WebApplication1.Models.PersonalDetail 

To display the property’s value of the Model, we can use @Model.PropertyNames like 

@Model.FirstName 

For more details around this, please see the Views (like Details.cshtml, Index.cshtml etc.) created under/Views/PersonalDetails at the time of creating Controller based on Model in the previous points.

 Views: 13670 | Post Order: 25



Write for us






Hosting Recommendations