Friday, January 26, 2007
This looks to be a terrific new tool for all web developers. Firebug allows you to inspect the contents of pages, scripts, css and DOM. I've only perused it for a few minutes but the possiblities are staggering. I sure could have used this before! Most interestingly perhaps is the javascript debugger that allows you to set breakpoints. Sweet!

1/26/2007 9:24:31 AM (Pacific Standard Time, UTC-08:00)  #    Disclaimer  |  Comments [1]  | 
 Thursday, May 26, 2005
Prior to coding modules for DNN I never used ArrayLists for DataGrid databinding. So that's when I ran into the 'no default member found for type' runtime error when trying to code a template column. As you know, when you bind to a DataSet and you need a field from the current record you use 'Container.DataItem('FieldName')'. I thought that in the DNN world with ArrayLists of Info objects the same would work but it does not. Turns out that Container.DataItem returns the object so you need to specify the property if there is no default one. For my http://www.ammotracker.com site I use it as follows:

<asp:TemplateColumn headertext="Gun"%>
<ItemTemplate%>
<asp:Label runat="server"%> <%# GetGunForSession(Container.dataitem().GT_OwnerGuns_ID) %></asp:Label%>
</ItemTemplate%>
</asp:TemplateColumn%>

Enjoy!
5/26/2005 10:40:14 PM (Pacific Daylight Time, UTC-07:00)  #    Disclaimer  |  Comments [7]  | 
 Wednesday, May 04, 2005
If you develop modules for DotNetNuke you are probably aware of Speerio's My Modules . This is a great package but for me the problem was the I could no longer debug properly with it. The issue was that objects in the watch window would no longer expand when clicking on the 'plus sign' to the left of it. I contacted Nik and he said I was the first one to run into this and suggested a few things I could try. None worked. Oddly I was seeing the same behavior at home and at work, both DNN 3.0.13 installs but with different custom modules.

I did some Googling but the problem was finding the right search term. Eventually I used VS.NET watch window problem "plus sign"  and that brought me here: http://www.dotnet247.com/247reference/msgs/37/185102.aspx . I added a new AssemblyInfo.vb file to the _DDNStub project. This resulted in a number of compilation errors. These can apparently safely be ignored but it's annoying so I removed the offending imports from the _DDNStub project. This didn't seem to have any adverse effects and the solution compiles fine now.

Bottom line:

Pros: I can now effectively debug my DNN modules without the overhead of checking all DNN modules. This is the big plus of My Modules over the standard DNN solution.
Cons: there is an additional DNNStub.dll assembly that gets generated as part of the solution. Given how hulking big DNN already is this isn't a problem for me (debug size is 6 KB).

As I'm the only one with this problem and the solution isn't particularly neat (see Cons) Nik didn't want to include this tip in his release package. I hope that Google will find this article for the next person who runs into this issue.

If someone has a better solution that doesnt' require DNNStub to be compiled I'd like to hear about it, please.

In closing I want to thank Nik for also providing the DNNDebug.aspx page which has indeed already saved me a lot of time figuring out an ascx problem. To use it simply navigate to <DNNSITE>/DNNDebug.aspx and follow the instructions.
5/4/2005 4:07:32 PM (Pacific Daylight Time, UTC-07:00)  #    Disclaimer  |  Comments [9]  | 
 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]  | 
 Wednesday, February 16, 2005

I was not totally happy with the functionality provided by the otherwise excellent http://www.ericjsmith.net/codesmith/ templates provided here: http://dnnjungle.vmasanas.net/Default.aspx?tabid=1 . So I figured it was about time that I contribute something to the DNN community and try to fix this myself rather than (again) asking for help. The attached zip contains my new template files. Since these have new names you can unzip them next to your existing template files, they won't get over-written.

From the readme:

Changes:
- Added 'PlusAdd' support. PlusAdd works by feeding an Info object with relevant fields filled in.
  If the record can be found no new one is created but another Info object is returned that is fully
  filled in. Consider it a 'add if it doesn't already exists'. Note that you may have to edit the
  stored procedure to alter the initial 'SELECT' query if needed to make the match more fuzzy. Note
  that if the record does not exist it is created and returned with the ID filled in.
- All template routines now use a multi table selector. This speeds up cases where you have lots of
  tables to mess with (can't you tell I had to? :-)

CodeSmithDNNTemplatesPlus.zip (14.78 KB)

Let me know what you think!

2/16/2005 11:02:47 PM (Pacific Standard Time, UTC-08:00)  #    Disclaimer  |  Comments [2]  | 
With a complext solution like DNN Visual Studio 2003 seems to get confused frequenty. Here is one such case and a simple workaround.
2/16/2005 9:56:22 PM (Pacific Standard Time, UTC-08:00)  #    Disclaimer  |  Comments [0]  | 
Introductory message
2/16/2005 2:49:19 PM (Pacific Standard Time, UTC-08:00)  #    Disclaimer  |  Comments [0]  |