This quick tip will show you how to enable your transformation to take full advantage of Kentico's navigation options.
In Kentico, editors have several options to choose from regarding navigation.
In many cases the defaults Standard behavior, Redirect to first child or URL redirection work just fine. There are some special instances where you want to use and enable the javascript option. If you're using the standard code
<%# GetDocumentUrl() %>
in your transformation, it won't catch any of this javascript code. The below code will capture the javascript
AND will use the default three options above, if needed.
<a href="<%# IfEmpty(Eval("DocumentMenuRedirectUrl"), IfEmpty(Eval("DocumentMenuJavascript"), GetDocumentUrl(),"#"), Eval("DocumentMenuRedirectUrl")) %>"<%# IfEmpty(Eval("DocumentMenuJavascript"),""," onclick=\"" + Eval("DocumentMenuJavascript") + "\"") %>><%#Eval("DocumentName")%></a>
Be sure to include that new column (DocumentMenuJavascript) in your list of columns in the webpart you're using.
Good luck and Happy Coding!
Posted by:
Brenden Kehren on September 06, 2016
Tags:
kentico,
navigation,
quick tip,
transformation