Creating dynamic pages and .net MVC - module or custom route?

Posted by Giovanni Mattucci on August 30, 2016

When creating a page to output data from a series of dynamic pages, is it better to define a module that is then tied to a view? Or is it better to create your own route (in RouteConfig.cs)?

I guess one pro of a module is that you can have the user reorder the modules.

   0 people like this question
15 30 50   per page
Awesome thanks :)
Posted By: Giovanni Mattucci

Hi Giovanni,

The good thing about Dynamic Pages in Agility is that when you create a Dynamic page in the Page tree and you set a "Page Path Formula" you are essentially defining the route in Agility.Web to match - so you don't need to write your own.

What you will need however is a Module to add on that dynamic page and within that module code you would call AgilityContext.GetDynamicPageItem<T>();. This will return an object representing your current dynamic page item.

You can see a source code example for this in the Products.ProductDetails controller action result from the sandbox sample site.

Posted By: James Vidler

Previous Next


Log in with your Agility username and password or
register for the site

Log In