Posted on

ASP.NET MVC: SHARED VIEW

The View / Shared folder contains all the visual controls that are to be displayed (used) in different parts of the site: are the old “user controls.” These controls can be called programmatically or called by the site itself automatically.

In this second case, imagine you create the “Student” model. In the View / Shared folder must exist (if not, create them) folders:

  • DisplayTemplates
  • EditorTemplates

If you enter in the 2 folders, 2 view dedicated to the display of “Student” model in two forms of viewing and editing, both named Studente.cshtml, the site will show you your custom control.