0

I'm attempting to design a skin with a footer menu and had some success with tabID. However, the tab ID would change if someone else uses the skin.

How do I set my footer menu to take in all children of a page called "Footer"? I have only a single "Footer" page within the page list and it contains T&C, Contact, Privacy policy etc.

Chun Yin
  • 290
  • 3
  • 13

2 Answers2

1

You can get TabInfo of Footer tab as follow, then access to all Tab's props, like TabID, ... using that

var tabInfo = DotNetNuke.Entities.Tabs.TabController.Instance.GetTabByName("Footer", PortalId);
var footerPageTabId = tabInfo.TabID;
// work with footerPageTabId ...
Mehdi Dehghani
  • 10,970
  • 6
  • 59
  • 64
  • Sorry if this is a really dumb question, but how do I write c# code for ascx pages? – Chun Yin Apr 30 '17 at 16:57
  • 1
    @ChunYin Open up `.ascx` file in `Visual Studio`, hit `F7`, the `Code File` (_.cs file_) will be opened, you can write `C#` code in that. simple copy/paste my mentioned code withing `Page_Load` method (_in opened .cs file_), and you are ready to go – Mehdi Dehghani May 01 '17 at 03:14
  • It seems like I'm missing the cs files as I can't open any of them, are there any ways to generate them automatically or do I have to manually create them? – Chun Yin May 02 '17 at 04:09
  • 1
    @ChunYin you can add that manually, but make sure the `.ascx` file is in `CodeFile` mode not `CodeBehind`, `CodeBehind` mode means the `C#` code lives in `DLL`. your project is `Web Application` or `Webite`? – Mehdi Dehghani May 02 '17 at 04:26
  • It's an IIS site. Are there any sample site templates with .cs files? I'm not sure what to declare upon creating a new cs file. – Chun Yin May 02 '17 at 08:01
  • [Getting Started with ASP.NET 4.5 Web Forms and Visual Studio 2013](https://learn.microsoft.com/en-us/aspnet/web-forms/overview/getting-started/getting-started-with-aspnet-45-web-forms/introduction-and-overview), or you can looking for `ASP.NET Web Froms tutorial` or something like that. (_btw you can use visual studio to add new `.ascx` file by right-clicking on any folder and following `Add -> New Item -> Web Forms User Control`_) – Mehdi Dehghani May 02 '17 at 08:22
0

After checking the documentation again, I realized there's a nodeselector option for "TabName" which I missed.

Using <dnn .. .. . ..NodeSelector='footer'> worked for me.

Another option would be the poster above's method where global variables are populated with the tabID and called with NodeSelector='<%# TabName %>'

Chun Yin
  • 290
  • 3
  • 13