Search code examples
c#-4.0dotnetnukedotnetnuke-moduledotnetnuke-6

How to get the tab ID from url in DotNetNuke


I have an url (e.g. http://localhost/Aanbod/Pagina.aspx) and I want to know the tab id, so I can make a friendly url with query (e.g. http://localhost/Aanbod/Pagina/QueryKey/QueryValue/).

Anyone has an idea?

Edit:
I'm not on the page itself. Want to know it from any page possible.
The url does not contain the tab id itself, so it can't be extracted.


Solution

  • if Pagina.aspx is a page in dotnet nuke like Home or Getting Started then you can find the tab id by

    DotNetNuke.Entities.Tabs.TabController objTab = new DotNetNuke.Entities.Tabs.TabController(); 
    
    DotNetNuke.Entities.Tabs.TabInfo objTabinfo = objTab.GetTabByName("Pagina", this.PortalId);
    
    int Tabid = objTabinfo.TabID;