ASP.NET Core 5.0 MVC View Edit

Murugan Andezuthu Dharmaratnam | 18 January 2021 | 100

Introduction

In the Model-View-Controller (MVC) pattern, the view handles the app's data presentation and user interaction. A view is an HTML template with embedded Razor markup. Razor markup is code that interacts with HTML markup to produce a webpage that's sent to the client.
In ASP.NET Core MVC, views are .cshtml files that use the C# programming language in Razor markup. Usually, view files are grouped into folders named for each of the app's controllers. The folders are stored in a Views folder at the root of the app.

Benefits of using views

    • The app is easier to maintain
    • The parts of the app are loosely coupled. You can build and update the app's views separately from the business logic and data access components.

Passing data to views

Data can be passed to views in two different ways. one is Strongly typed data: viewmodel and second is Weakly typed data: Viewdata and Viewbag.