Using 2sxc, I have a hero module that I use across the website on all pages. It looks like this:
It uses "@Content.Title" for the h1 tag so it displays "Scholarships". But I need to make a breadcrumb that gets the parent page's name of the current page. So in this case, "Teachers".
For example, this hero also exists on other pages like "Volunteer" and it has a parent of "Get Involved" so the breadcrumb would dynamically show "Get Involved".
So far, here's my code:
@if (@Dnn.Tab.ParentId != -1) {
<nav class="uppercase text-sm font-semibold tracking-wider"><span class="text-honeydew visited:text-honeydew">@Dnn.Tab.ParentID</span> <span>/</span></nav>
}
This works to handle heroes on a root page (to not show the breadcrumb). But I can only seem to output the ParentID.
How can I use the @Dnn.Tab.ParentID to get the Parent tab's name using c#? Or is there another way to go about this?
Easiest thing to do is use the TabController to turn a TabId in to a TabInfo
@using DotNetNuke.Entities.Tabs
@functions {
private TabInfo GetTabInfo(int tabId)
{
return TabController.Instance.GetTab(tabId, Dnn.Portal.PortalId);
}
}
So then just call it all in one like this with .ParentId...
<pre>
Debug:
Parent Page Name: @GetTabInfo(Dnn.Tab.ParentId).TabName
</pre>