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 @modeldirective. 
@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.

No comments:

Post a Comment

How to register multiple implementations of the same interface in Asp.Net Core?

 Problem: I have services that are derived from the same interface. public interface IService { } public class ServiceA : IService { ...