John URMC
John URMC

Reputation: 33

Display standard Kentico CMS document page using MVC controller

Is there an easy way to use an MVC controller in Kentico; and, return a specific page that has been developed in Kentico, as opposed to referencing something like ~/Views/ControllerName/SomeView.cshtml?

I'm trying to use the MVC controller to provide some needed routing functionality, and already had a working page prior to using the controller. I would like the display to be pulled from the working page I had before using the controller.

I'm using Kentico 7.

Upvotes: 0

Views: 277

Answers (3)

Martin Makarsky
Martin Makarsky

Reputation: 2650

Trevor is right - there is an ASP.NET MVC support in Kentico v7 you can use but there is nothing like MVC Portal Engine or something like that. There are two possible ways how to achieve your scenario:

You can use Kentico as a 'model' and read (manipulate) data via API in your controller and view (typically in Razor). Then you need to:

a) register route to your controller in CMS Desk > Node > Properties > URls and choose proper Path type (route or MVC) - this is prefered way

b) create MVC page template in Site manager > Page templates

You can find example on Corporate Site (part of default installation) in CMS Desk > Corporate Site > Examples > Development Models > MVC

You can learn more in Kentico CMS 7 documentation (MVC development overview section).

Please note there is whole new MVC approach in latest version (Kentico 9).

Upvotes: 0

Enn
Enn

Reputation: 2209

Portal engine is based on web forms and components such as web parts, page templates or widgets are not supported by MVC itself so you wont be able to display your page using MVC.

Kentico 10 will contain many new features regarding MVC, but mixing portal engine with it will not be the case.

Upvotes: 0

Trevor F
Trevor F

Reputation: 1437

Especially in Kentico 7, MVC support was more or less "you can use it, but it won't be usable with portal functionality."

You can have MVC pages, and have Portal pages, but there really isn't a way to pull in a portal style page into it. You're best bet is to try to either use some custom logic to render the elements you need and pull in that content dynamically into the page.

I could be wrong, my MVC isn't as strong as my kentico.

Upvotes: 1

Related Questions