Published on

Navigating from List to Detail no hardcoded routes


The problem with a free-flowing CMS where users can add content anywhere, is that users can add content anywhere. A common problem is you might want your users to be able to click on a list item, then have a “Back” or “Browse more” button in the UI at the bottom of the detail view.

This is simple with a static site because the routes are known in advance and never change, but a CMS is powered by a database and a user could restructure the sitemap on a whim, we just don’t have the luxury of hardcoding routes.

Here’s the fix though in a nutshell

  • List links pass along a returnUrl querystring parameter
  • Detail page looks for that and creates a back button

This sample also adds a fallback route, you could just skip and hide the button instead if you want. Just don’t ALWAYS count on the querystring being there. If you don’t check for NULL on it, the view will throw an exception.

Boost your online presence.

Let us create the perfect digital experience for your company.

Contact us now