Reputation: 452
Is it possible to create a View with a model but without creating any controller in Sitecore MVC 7.2.
Upvotes: 1
Views: 966
Reputation: 3521
If you want to do this the "plain" Sitecore way. Just right-click the item "Sitecore/layout/renderings" and insert an item of type "View Rendering". Add the path of your view in the "path"-field.
This video is a very good introduction to Sitecore MVC http://youtu.be/i3Mwcphtz4w
This is also a very good source for learning about Sitecore MVC: http://sitecore-community.github.io/docs/
Upvotes: 1
Reputation: 8877
Yes, you can.
It's easiest with Glass Mapper, but you can do it out of the box as well.
Glass implements a processor in the mvc.getModel
pipeline that looks for the model type in the View Rendering definition and creates an instance for you before executing the view.
See this tutorial for an example.
Out of the box you can create a Model item underneath /sitecore/Layout/Models
that refers to a class.
You can then select the model item in model field of your View Rendering.
Upvotes: 1