Thursday, March 10, 2005
When I started thinking of how to port an existing ASP.NET application to DNN or how to write a new one I quickly found that I needed the ability to jump around from tab (page) to tab, passing parameters if needed. This seemed to be a pretty foreign concept in the DNN forums as there wasn't anyone who said 'use method xyz of object pqr for that'. There were some hints that lead me in the right direction and using a debugger I found the datastrucure that contains all current tabs and their corresponding data.

In my code I have a page that lists a bunch of charts that in turn get viewed by the 'View Chart' tab. So in the page_load event handler for the chart list ascx I look up the tabid of the View Chart tab as follows:

            Dim list As ArrayList = Me.PortalSettings.DesktopTabs
            Dim theitem As Object, TheTab As DotNetNuke.Entities.Tabs.TabInfo
            For Each theitem In list
                TheTab = CType(theitem, DotNetNuke.Entities.Tabs.TabInfo)
                If TheTab.TabName = "View Chart" Then
                    PerfChartTabId = TheTab.TabID
                    Exit For
                End If
            Next
The PerfChartTabid variable is local to the code behind class.

Later on I call the following function to get the correct URL to redirect to the View Chart tab:

        Public Function GetTabURL(ByVal TabID As Integer, Optional ByVal Params As String = "") As String
            Return DotNetNuke.Common.Globals.NavigateURL(TabID, "", Params)
        End Function


Note that I fully qualify the call to NavigateURL unlike most examples out there. I had to hunt down the location of this elusive shared method and want to spare you the effort.

I hope this helps someone!