Published on

Fixing Ugly Hierarchical DynamicContent Urls


The module builder gives is a lot of power, and a little while ago it was enhanced to allow nested types.

Exhibit A:

Hierarchical Module

So using the default front-end control, to get to a “case” it always has to render it’s parent out…that’s how it knows which “case” to load (if it wasn’t there you might have 2 cases in different libraries with the same url name).  Clearly it exists this way because the general user has no idea about routing, they just want to drop the control on the page and have it work.

Here’s the problem with that…the url ends up being ugly if you’re not using the control if “full” “default” dynamic mode.

By that I mean lets say you have a page created to show JUST detail items.
…this type of setup allows your “detail” view to have a different page template than the master listview right.

SOOO…with the default control on both the master and the detail page, and the master control set to open detail items on the detail page this is what your url would look like.

…redundant as all hell.

So whats the fix, well it’s actually not too hard to implement, but it would be AWESOME if telerik could include this ability in a future version of the control.

We’re just inheriting from the DEFAULT control, and TELLING it what the parenturl is, so it’s not inferring from the url.  The beauty is that it only does anything if the ParentUrlName is set, if it isn’t the control behaves as it always would.

So from here all you need to do is compile and change the “Control CLR Type or Virtual Path” field in the toolbox to be your custom control instead of the default.

(NOTE: Don’t forget to actually SET the parenturlname when editing the advanced properties of the control)