I've created a condition that checks to see if the current child node is the first in the set of children. If it isn't the first child then the URL is generated easily with .Previous().Url. If it is the first child it needs to default to the last child in the set of children.
As you can see above I added .LastChild() after @CurrentPage.Up() knowing that this doesn't work but I thought it would illustrate the desired functionality. I've searched all over for the solution but haven't had any luck yet. Thanks for any help!
Access last child in children
I've created a condition that checks to see if the current child node is the first in the set of children. If it isn't the first child then the URL is generated easily with .Previous().Url. If it is the first child it needs to default to the last child in the set of children.
As you can see above I added .LastChild() after @CurrentPage.Up() knowing that this doesn't work but I thought it would illustrate the desired functionality. I've searched all over for the solution but haven't had any luck yet. Thanks for any help!
Would System.Linq.Last() method not work here?
As Alex mentioned, you should be able to use LINQ .Last() in this case. Here is an example of how this could be solved with a little helper:
That worked exactly as needed. Thanks!
Awesome! I'm glad I could help and thanks for the response!
Have a great weekend, take care!
is working on a reply...