How do I access the topmost menu item give a tabid?

Last post 06-13-2005 1:49 PM by Nocturnal. 10 replies.

Sort Posts:

  • How do I access the topmost menu item give a tabid?

    06-11-2005, 5:11 PM
    • Contributor
      5,654 point Contributor
    • aaava
    • Member since 07-09-2004, 2:41 AM
    • Posts 1,170
    Hi folks:

    I'm trying to find the toplevel tabid given a tabid for a submenu or sub-submenu...Well you get the diea.  Is there a DNN core function to get this?  I've been poring over the core code, but haven't found a way to do this.  Thanks for any input!

  • Re: How do I access the topmost menu item give a tabid?

    06-11-2005, 6:33 PM
    • Contributor
      5,654 point Contributor
    • aaava
    • Member since 07-09-2004, 2:41 AM
    • Posts 1,170
    Well, it *is* the weekend. ;-)  How about this question.  What does the GetTabsByParentID() function do?  Does it return an array list of all the parents of a given tab, or does it list all tabs for the parent of a tab?  Anyone?  Buehler?  Buehler?
  • Re: How do I access the topmost menu item give a tabid?

    06-11-2005, 7:07 PM
    • Star
      13,145 point Star
    • J7Mitch
    • Member since 10-19-2002, 1:23 PM
    • Posts 2,632
    • TrustedFriends-MVPs

    PortalSettings.ActiveTab.BreadCrumbs  should help

    John M.

    DotNetNuke Module for Performance
  • Re: How do I access the topmost menu item give a tabid?

    06-11-2005, 8:21 PM
    • Contributor
      5,654 point Contributor
    • aaava
    • Member since 07-09-2004, 2:41 AM
    • Posts 1,170
    Yeah, ended up realizing it's a sql store proc, and looked at it.  It returns all the tabs for the parent (only for one level).  So it didn't do what I wanated.  I finally found where 'PortalSettings' was defined in the class browser (actually PortalController and TabController).  Man, why don't they have a search capability for the Class Browser in ASP.NET?  It's like a zoo in there. ;-)
  • Re: How do I access the topmost menu item give a tabid?

    06-12-2005, 10:13 AM
    • Star
      13,145 point Star
    • J7Mitch
    • Member since 10-19-2002, 1:23 PM
    • Posts 2,632
    • TrustedFriends-MVPs
    For search, I usually just search the Source Code if I have it. 
    If you don't have Source then you might want to use Lutz Roeder's Reflector which has search capability.
    John M.

    DotNetNuke Module for Performance
  • Re: How do I access the topmost menu item give a tabid?

    06-12-2005, 2:45 PM
    • Contributor
      5,654 point Contributor
    • aaava
    • Member since 07-09-2004, 2:41 AM
    • Posts 1,170
     J7Mitch wrote:
    For search, I usually just search the Source Code if I have it. 
    If you don't have Source then you might want to use Lutz Roeder's Reflector which has search capability.


    Yeah, that's actually how I found it.  Used UE looked for all instances of PortalSettings, and in global.ascx found it was instantiated froma PortalController I think.  I don't remember it was so late. ;-)  But for anyone else out there, you traverse the Tabs using a TabController, which you use to get TabInfo object, which holds all the info for a Tab...
  • Re: How do I access the topmost menu item give a tabid?

    06-13-2005, 3:30 AM
    • Star
      10,740 point Star
    • nokiko
    • Member since 10-22-2002, 2:36 PM
    • Utrecht, Netherlands
    • Posts 2,146

    The function I use

    Public Function GetTopTabID() As Integer

    Dim objTabs As New TabController

    Dim objTab As TabInfo

    objTab = objTabs.GetTab(_portalSettings.ActiveTab.TabId)

    While objTab.ParentId <> -1

    objTab = objTabs.GetTab(objTab.ParentId)

    End While

    Return objTab.TabID

    End Function

     

    Armand Datema
    5 Skins, 4 SkinObject, 38 Containers, 2 Modules and more Euro 50 a year.
    SchwingNuke
    Offshore DNN and ASP.net development
    Container Creator
  • Re: How do I access the topmost menu item give a tabid?

    06-13-2005, 3:58 AM
    • Contributor
      2,850 point Contributor
    • Nocturnal
    • Member since 10-14-2003, 6:58 PM
    • Ridgefield, CT - USA
    • Posts 570
    That is a very expensive way of doing that. I'll admit that I have no alternative but each objTabs.GetTab is a trip to the database. Isn't all this information already present in the ModuleBase? After all the menu already got rendered and it used the same data. Was it thrown away after the menu was drawn?
    SquadEngine for game squad and clan hosting
    GravityPoint for all other group portal hosting
    TungstenTech: DNN Site
  • Re: How do I access the topmost menu item give a tabid?

    06-13-2005, 4:10 AM
    • Star
      10,740 point Star
    • nokiko
    • Member since 10-22-2002, 2:36 PM
    • Utrecht, Netherlands
    • Posts 2,146
    yeah its not the best way but i couldnt find any other way of doing this and most of it is cached anyway so in reality it just takes a few miliseconds to do thi call
    Armand Datema
    5 Skins, 4 SkinObject, 38 Containers, 2 Modules and more Euro 50 a year.
    SchwingNuke
    Offshore DNN and ASP.net development
    Container Creator
  • Re: How do I access the topmost menu item give a tabid?

    06-13-2005, 8:23 AM
    • Star
      13,145 point Star
    • J7Mitch
    • Member since 10-19-2002, 1:23 PM
    • Posts 2,632
    • TrustedFriends-MVPs

    PortalSettings.ActiveTab.BreadCrumbs is an ArrayList of all the ancestor TabInfo objects.

    To get the Top Most TabId of the active tab you can use something like this:

    Ctype
    (PortalSettings.ActiveTab.BreadCrumbs(0),TabInfo).TabID

    No extra call to the DB is needed.  PortalSettings is populated with a ton of information and cached for the request, making extra DB calls uneccessary in most cases.

    John M.

    DotNetNuke Module for Performance
  • Re: How do I access the topmost menu item give a tabid?

    06-13-2005, 1:49 PM
    • Contributor
      2,850 point Contributor
    • Nocturnal
    • Member since 10-14-2003, 6:58 PM
    • Ridgefield, CT - USA
    • Posts 570
    Thanks John, that's really helpful.
    SquadEngine for game squad and clan hosting
    GravityPoint for all other group portal hosting
    TungstenTech: DNN Site
Page 1 of 1 (11 items)