How to render a view in sitecore 7.2 MVC ..?

I am building an MVC application in Sitecore 7.2 MVC, I installed sitecore 7.2 and hosted it in IIS I also added a Views, Controller and Models folder. I created Views and now I am processing it with a controller action in sitecore. I'm a little confused here. I can't find the RouteConfig file, so when I define the HomeController and the basic action that is executed first ..

Any MVC expert with sitecore please help me how to execute HomeController action to render the view.



source to share

2 answers

No manual registration required. After creating the view method and controller action, simply create a new controller render and fill in the Controller and Method fields with the appropriate controller and method names. Sitecore already has a default route set and it uses dependency injection to pull the right-hand control using values ​​from the Controller and Method fields.



As Vasily pointed out, you need to create a render of the controller. Sitecore does not use the same routing mechanism as a standard ASP.NET MVC application.


  • Creating a controller and controller action
  • Create view
  • Create a controller render in Sitecore> Layout> Renderings (I usually organize my renderings in application specific folders like SiteA, SiteB, etc.)
  • Add rendering to content item

In the Render Controller you will need to fill in the Action Controller and Controller properties.

enter image description here



All Articles