I have a Hierarchical Viewer set up to display news content laid out by year -> months.
What I want to do is, in the Months links, I want to add a data attribute to include the year. So it transforms to something like <a data-date="2015 January">January
Which means, in my child transformation, I need to access the parent node's document name. I'm not having very much success in doing so. Can anyone help me with the transformation syntax?
Thanks.
If you know where in the url string it is you can use a simple split method on the NodeAliasPath field like so:
Your url is /news/year/month/news-item
<a data-date='<%# Eval("NodeAliasPath").ToString().Split('/')[2] %>'>January</a>
Sounds like you are overengineering this one :) why not simply use the newsreleasedate column with a to date string "YYYY"?
Because "News" was just an abstract example and not the page type I'm actually applying this to. But thanks anyways. :)
Please, sign in to be able to submit a new answer.