问题
I am trying to add some code I found on this forum in my skin .ascx file to display the name and link of the Active Page's Root level Parent. I am using DNN 9.1.1. Here is where I found the code: How to get name & link of parent page in DNN
<a href="<%= ((DotNetNuke.Entities.Tabs.TabInfo)PortalSettings.ActiveTab.BreadCrumbs[0]).FullUrl %>"><%= ((DotNetNuke.Entities.Tabs.TabInfo)PortalSettings.ActiveTab.BreadCrumbs[0]).TabName %></a>
It works visually, but I am getting some weird issues. With the code added, while in the edit mode, it makes a class="DNNAjaxPanel" div disappear. This div is used to help when you drag a module into a Content Panel. It is the div just above this div class="DNNEmptyPane dnnSortable dnnModuleManager ui-sortable"
Use the Inspect Element feature of your browser and you will see what I mean.
Here is a Screen shot with the div class="DnnAjaxPanel" that is there before I use the code: Screen shot with div class="DnnAjaxPanel"
When I add the code it makes that div disappear. Then when I add a module to that Content Pane it makes all the modules go to that one Pane no matter what other content pane they are currently in.
Is this a bug with DNN 9.1.1 or can I not use the code in my skin ascx file?
Thanks, Craig
回答1:
You Are probably using a VB skin. You can check this at the top of the page with "language": <%@ Control Language="vb" AutoEventWireup="false"
The below code works with DNN 9, tested it.
<a href="<%= CType(PortalSettings.ActiveTab.BreadCrumbs(0),DotNetNuke.Entities.Tabs.TabInfo).FullUrl %>">
<%= CType(PortalSettings.ActiveTab.BreadCrumbs(0),DotNetNuke.Entities.Tabs.TabInfo).TabName %>
</a>
C# version
<a href="<%= ((DotNetNuke.Entities.Tabs.TabInfo)PortalSettings.ActiveTab.BreadCrumbs[0]).FullUrl %>">
<%= ((DotNetNuke.Entities.Tabs.TabInfo)PortalSettings.ActiveTab.BreadCrumbs[0]).TabName %>
</a>
来源:https://stackoverflow.com/questions/48666562/in-dnn-9-how-do-i-display-the-name-and-link-of-the-active-pages-root-level-pa