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!
3/10/2005 5:22:37 PM (Pacific Standard Time, UTC-08:00)  #    Disclaimer  |  Comments [4]  | 
On the ASP.NET forums someone asked if you could use IFrame modules to encapsulate existing application pages. Unfortunately the answer is 'no'.Iframes are pretty much useless for using DNN user information as they result in separate requests to the server which of course is clueless about your other DNN request. So that method is out.

What I did was as follows:

- get DNN to compile/debug as-is
- install VS templates for DNN from dnnjungle (sorry, no URL handy)
- add a DNN module project to the DNN solution using the new templates
- put some simple stuff (plain text or whatever) in the view ascx
- remove code from ascx code behind that references biz layers and other db stuff
- compile
- add module to framework according to the module dev. document
- open your existing application in another VS session
- copy all text between <form></form> of your aspx to your ascx
- copy all code behind methods to your ascx.vb
- splice in the me.userid and other user related things as needed
- add your own data access project to the solution (add it to the build project as well)
- for each additional page of your original app, add another ascx to your project. No need to start a new module for that

This is what I did with a reporting application I wrote in plain ol' ASP.NET that I wanted to move into DNN. In my case the db was separate from the DNN database. In a different app that I'm writing from the ground up to use DNN I'm using the same db though. Plenty of room for other tables/procs. I use a prefix to separate the DNN stuff from my own.

Good luck!

3/10/2005 5:07:08 PM (Pacific Standard Time, UTC-08:00)  #    Disclaimer  |  Comments [1]  | 
 Tuesday, March 08, 2005

It seemed like a good idea to separate my various interests a little bit so I started a separate blog here:

http://blog.ammotracker.com

3/8/2005 10:36:51 PM (Pacific Standard Time, UTC-08:00)  #    Disclaimer  |  Comments [0]  |