Creating a DotNetNuke Module using notepad - For absolute beginners!

I think have written what I hope to be is the simplest tutorial for the absolute beginner who wants to learn how to make a custom module for DotNetNuke. 

http://adefwebserver.com/DotNetNukeHELP/DNN_Module1/

SilverlightDesktop.net

A framework that allows you to dynamically load Silverlight modules into resizable draggable windows.
0
adefwebserver
10/12/2004 8:55:18 PM
asp.net.dotnetnuke 25171 articles. 0 followers. Follow

21 Replies
743 Views

Similar Articles

[PageSpeed] 35

Congratulations and thank you for this needed lesson.

Best regards,
Sam Tanner
Sam Tanner

Easy Template Skins for dotNetNuke
0
SamTanner
10/12/2004 9:47:54 PM
Excellent, now I've read the book, when is the movie coming out?
0
lou
10/13/2004 1:19:25 AM
Just curious, why did you use notepad and not visual studio for your tutor? Thanks for the contribution.
Brian Scarbeau
http://sws.lhps.org
0
bgscms
10/15/2004 8:10:20 PM
Thank you this actually made a click for me on developing modules
Dylan Barber
read my stupid blog http://codemypantsoff.com
Pants Optional!
0
codegalaxy
10/15/2004 8:38:38 PM
That is a good question, and as I am working on another tutorial that will show you how to use the data access layer using notepad, it is one that I am asking myself… why??

I just think that the exercise is beneficial to people who process information differently. For my data access layer tutorial I will preface it with:
“Do not actually use notepad to develop modules! Get a used copy of visual studio from Ebay for $60! What are you crazy? J ”
However I am plugging away at this tutorial anyway because I think it will first help myself learn how to do it (I have read the articles on wwwcoder and bonosoft a dozen times) and then others to understand the concepts so that they can then do the CORRECT thing and follow the directions at http://www.dotnetnuke.dk/Default.aspx?tabid=60 for creating modules.
I am an old ASP developer who started asp.net using Web Matrix (basically notepad with an easy way to make a asp.net UI). I only bought a copy of Visual Studio to create modules. After I bought Visual Studio it sat there because I didn’t know how to use it and this was a year after I built an entire site using Web Matrix (RegistryPalace.com). It was only after making a module using notepad that Santry’s article made any sense to me (I have read the series at http://www.wwwcoder.com/main/parentid/224/site/3008/68/default.aspx at least 10 times!)
I realized that there are others like me that need things explained to them from the “notepad” level. I thought I would give something back to the community and make the tutorial. I think the real contribution will be explaining how to use the data access layer that is covered in Shaun Walkers “DotNetNuke Data Access Whitepaper” (http://dotnetnuke.com/Default.aspx?tabid=478) (I have read it so many times I had to print it out twice!). I expect this new tutorial to be downright stupid. It will only be an attempt to explain by example. Using this method for module creating would be like trying to build a house out of toothpicks.
Most of the people developing modules are really sharp people who probably cringe at the thought of programmers needing such basic tutorials. But, we all have to start somewhere and for old asp programmers we basically have to start from scratch.


SilverlightDesktop.net

A framework that allows you to dynamically load Silverlight modules into resizable draggable windows.
0
adefwebserver
10/15/2004 9:12:32 PM
Well, don't usually hijack posts, but this work looks suspiciously familiar, and I'll leave it at that.  For those of you wanting a more in depth look at the process, you can visit my handcoded site and pull down some documentation that you can view off line.  The site focuses on HandCoded methods, for users without access to VS.Net tools, but there's a lot of resources and info for others as well.

Ta! ;)
iwonder
Mission, KS - USA
0
iwonder
10/15/2004 9:41:58 PM
to iwonder:

I read your wonderful documentation a bunch of times and learned a lot from it. If you see anything that I used from your work without giving you credit please let me know I’ll fix it immediately and believe me it was inadvertent.
The main difference between your document and my tutorial is that my tutorial is VERY simple. You take on the survey module, which is not a simple piece of code.
All I do is write a string into the module configuration setting and retrieve it. I compile it (without using your more useful and logical batch files) and I zip it up and install it. Real world usefulness=zero, education value=priceless?


SilverlightDesktop.net

A framework that allows you to dynamically load Silverlight modules into resizable draggable windows.
0
adefwebserver
10/15/2004 10:03:05 PM
Michael; Thanks for the tutorial. It was eminently useful in understanding what was going on. Now what I need to find is a similar tutorial on using VS2003 to do the same thing. I might be able to make the translation, but if  you have any hints, please advise. 
FYI, I made a terrible mistake during the module definition, and finally figured out what happened. Try it at your own risk. Where you are defining the second control, your instructions are to enter a key 'EDIT'. I didn't do that. All goes well until you add the second control to the test page. Apparently DNN thinks they are both named '{blank}' and complains with a Very long error message that you can't have two controls on the same page with the same control id. It allows you to add them but crashes if you try to delete them. Only way out is to delete the page. I have it so tangled up now it will not add the module to a new page (allows you to select and 'add' it but it never shows up).
Nonetheless, I was able to go with the compiles etc. reinforced my ASP.Net learning. thanks
0
PhilM99
9/26/2005 10:02:55 PM
 PhilM99 wrote:
Now what I need to find is a similar tutorial on using VS2003 to do the same thing. I might be able to make the translation, but if  you have any hints, please advise.


Simply go to DotNetNuke.dk and buy DAL Builder Pro. You open the program, go through the wizard and it creates a "Hello World!" project for you in 30 seconds. It is that code that I use in my tutorial. It will then allow you to easily create the Data access layer to talk to the database. However it is the "setting up DotNetNuke to work with VS 2003" that it really shines. I can't not think of an easier way to start a module. Nothing comes close to 30 seconds, trust me.

However before using it follow every single direction given here.

SilverlightDesktop.net

A framework that allows you to dynamically load Silverlight modules into resizable draggable windows.
0
adefwebserver
9/27/2005 1:28:17 AM
I did that and I believe I have followed all the instructions.

Interesting, yesterday I had success with the notepad approach, but after screwing around with it for a while, my moudle would not appear on my test page.
So, as I have posted on the DAL builder site, I purchased DAL builder Pro (thanks for the tip) installed it and ran the 'sample'. I opened the VS2003 project and successfully built the solution.
Then I went to my dev DNN site and added the module, the module definition and the three controls.
Same thing! the module appears in the module drop down, but after you click add, nothing appears in the content pane.
Ideas?

Secondly, I have a related question. At no point, do I need to rebuild the entire DNN solution, right? The DAL Builder finds its reference to the DNN project on my dev machine, and beacuse I manually add the module, the DNN solution does not need to be rebuilt. ??

Thirdly, what's a reasonably fast way to test. You can build a user control in the project, but cannot run it directly. So do you just keep switching to the DNN localhost and try it out? You don't need to reload it, do you?

Thanks
0
PhilM99
9/27/2005 7:46:21 PM
I think I know what you forgot to do. You forgot to actually build the project :) You have to have a ".dll" for your module you are working on in DotNetNuke's "bin" directory. Meaning you have tio have the code to actually run the module in a .dll and that .dll needs to be in DotNetNuke's bin directory.


Now this does NOT apply to my Notepad tutorial because there I am telling you to tell the .ascx control that the code is in a text file NOT a .dll. However if you have finished my tutorial, on the last 2 pages, I have now told you to change this and tell the .ascx file that the code IS in a .dll.

Now, if you haven't compiled the code and put the .dll in the bin directory of your DotNetNuke instal then it wont work (I describe how to do this on the last 2 pages of the tutorial).

You see if you create a module definition it will show up in the modules drop down list. But if there is not .dll for the module it of course will not actually work.

Secondly, you should rebuild dnn once as it tells you to in the instrictions on the dotnetnuke.dk site

Thirdly, every change you make to your control using DAL Builder Pro you have to BUILD the project in VS2003. Then when you reload the page in localhost you have to wait 20 seconds for the entire DotNetNuke application to realize that you just updated the .dll" of your module (it detects that a .dll in it's bin directory changed) and to recompile itsself.


SilverlightDesktop.net

A framework that allows you to dynamically load Silverlight modules into resizable draggable windows.
0
adefwebserver
9/27/2005 11:08:54 PM
Tried your suggestions, to no avail.

1) Yeah, I had already built the solution. I was puzzled as to how the dll got over to the bin directory in DotNetNuke, but now I see how that works. I had checked and the dll was already there. I think I may have been having trouble trying to figure out how the module name, friendly name, etc. relates to what I call the project and therefore the resulting name of the dll.

2) Yeah, I had already rebuilt the dnn solution but I did it again.

3) OK, that's what I thought. I did indeed rebuild my project (it's the vanilla one DAL Builder built for me). I checked and my updated dlls are showing up in the DNN bin.

The module doesn't appear on the page.
I'm beginning to see where there are holes in the DNN implementation. Not complaining, because it seems great, but I can't off square zero here to try my hand at programming. At this point I have modules I can't delete because I entered (I was allowed to) an invalid folder name (thinking I had to key in the 'DesktopModules' part). It lets you put it in but it won't work because it's wrong and it won't let you delete it because said folder path does not exist. Catch-22.
I also found that you are allowed to enter controls on the module definition with duplicate names (blank) resulting in horrendous errors that prevent you from using the module. You can fix that one, at least.

OK, those were all rookie mistakes. But since I had this sucker working at one point and now I can achieve nothing, I'm thinking of nuking (get it?) the whole installation and starting over. This is a privilege I have, given that I have achieved nothing but I sure would like to think I won't have to do that down the road some when there's lots of valuable data in there.

All this leads to one final question before I start over. Is it just me or does this module definition thing need some work? I cannot figure out exactly what name (assembly) to match up with what on the definition, and there appears to be no checking on the way in. If I can try it one more time tomorrow, I'd like to, but at this point, I cannot figure out how to make amodule actually show up on the page, unless it's a canned one that came with DNN.

Hmmmmmm Ideas Welcome
Phil



0
PhilM99
9/28/2005 3:27:00 AM
Don't give up. I almost gave up and now I make modules with ease.
1) delete the modules from all the pages and delete the pages
2) delete the module definitions you made.
3) delete the .dll's from DotNetNukes bin directory
4) delete the folders for the modules you created

This usually works for me. if it still doesn't blow out DotNetNuke and start again. you're using a "development installation" right? :)

If you install my finished module on this page, does it work?

The DAL builder site describes exactly what to enter for you module definition with screen shots. When ever I made a mistake it was because I missed a step. Try it again :)



SilverlightDesktop.net

A framework that allows you to dynamically load Silverlight modules into resizable draggable windows.
0
adefwebserver
9/28/2005 1:25:45 PM

OK, one more shot. But as I said I cannot delete all the modules becuase one of them had its folder 'misspecified' and becuase that folder is invalid, I cannnot delete it. That may indeed be the one that is causing all the problems.

BRB

Phil

0
PhilM99
9/28/2005 1:32:35 PM
if you:

1. Log in as host
2. Go to HOST then SQL
3. Enter "select * From DesktopModules" and click execute
4. Find the entry you want to delete and enter a query to delete it by it's DesktopModuleID
For example:
"DELETE From DesktopModules where DesktopModuleID = 99"

SilverlightDesktop.net

A framework that allows you to dynamically load Silverlight modules into resizable draggable windows.
0
adefwebserver
9/28/2005 5:17:51 PM

Thanks for the info about deleting the module. Was able to use SQL to clean up.

Unfortunately, I still cannot add a module I build into the system (it just simply does not show up).

I though something was wrong with my DNN development system, so I deleted it and rebuilt it. About an hour, including goofs.

Then I used DAL Builder Pro to build a new project. First problem is it was missing a reference to DotNetNuke so would not build.

So I deleted it.

the I rebuilt it making absolutely sure I had specified the directory of the root DNN folder. Still a missing reference. So I added it, then rebuilt the project, and the dll showed up in DNN/bin.

But the module will not show up on a test page.

In directory C:\DotNetNuke\DesktopModules\LWIMods\bin I have LWI.LWIMods.dll. It is also showing as C:\DotNetNuke\bin\LWI.LWIMods.dll

Can you give me any clue as to whether I am registering it correctly.. what should I put in as the module definition?

What could possibly be wrong??? Second day on this one.......

Phil

 

 

0
PhilM99
9/28/2005 8:23:47 PM
Is your DotNetNuke installation working correctly otherwise? What version are you running?

Did you buy the latest DAL Builder Pro for DotnetNuke 3.0? You didn't accidentally get the old version?

1. Download and install the module here.
2. Does it work?



SilverlightDesktop.net

A framework that allows you to dynamically load Silverlight modules into resizable draggable windows.
0
adefwebserver
9/29/2005 1:47:22 AM

Thanks for hanging in with me Michael. I'm definetly doing something stupid or NOT doing something I'm supposed to.

Yes, my DNN seems to be working fine. 3.1.1.

Yes, I bought the DAL Builder for DNN3. No I checked what I got.

I downloaded the module from your link. I placed the contents in a directory I called ImportantMessages (in DesktopModules).

I didn't have enough (no solution or vbproj) to compile it so I went ahead and registered it the same way as as I have been doing with the others.

I add a module definition
(The screen reads Edit Module Definitions, I key in:
Module Name: ImportantMessages
Folder Name: ImportantMessages
Firendly Name: Messages that are Important
I hit update the add module definition section appears. It's unclear to me what this is.
I key in:
New Definition: NEWDEF. I hit Add definition. (Does it matter what this name is? What's it for?)
The add control section appears.
I hit Add Control. For Key I put in SHOW, select the Showmessages.ascx, set type to View, leave title blank, hit update.
I repeat with Write, WriteMessage.ascx, Edit, title blank, update.
The two controls show with the correct path. There's nothing else to hit.
Then I'm done installing the module as far as I know so I create a test page, try to add the module (it shows in the drop down box) and click Add but it never shows up.
So then I says to myself, I thought it had to be in the DNN/bin directory so I copy the dll over there to no measurable effect.
I gotta be skipping a step.
I keep reading and studying and experimenting, but can't hit it.

So your test fails as well, and that exonerates my DAL Builder Pro, but points right at me as failing to install this module correctly.

Humbly yours, Phil

 

0
PhilM99
9/29/2005 5:04:40 AM

opps I meant for you to install that like this:

A) Login with the HOST account or one that has Host access
B) After logging in, go to the "Host" then "Module Definitions"
C) Select "Upload New Module"
D) Click "Browse" to browse to the "Test.ImportantMessages.zip" file and click on "Add"
E) Click "Upload New Files" to install the module
F) Add the module to the tab/pages of your choice

We need to see if that works. It should.

As far as the definition you created
* Friendlyname "ImportantMessages"
*For the View Control at "DesktopModules/ImportantMessages/ShowMessage.ascx" the Type is VIEW and  do not enter anything for Key

Also with DAL Builder Pro, if you enter the definition exactly like it is shown here:
http://www.dotnetnuke.dk/Default.aspx?PageContentID=105&tabid=211
It should work every time. the only time it has not worked for me is when i forgot to BUILD the project in VS 2003 first :)

We will stick with this until we get it working.



SilverlightDesktop.net

A framework that allows you to dynamically load Silverlight modules into resizable draggable windows.
0
adefwebserver
9/29/2005 1:20:27 PM

It's working It's working It's working

Now it's working. I'll review. I had not yet read your last message.
I followed your link and unzipped the files into desktopmodules/showmessages.

Last night I reported that it did not work.

This morning I did it again and it did not work.

I went to another machine after suspecting a problem with this one (a script blocker, maybe?).

I got my DNN working there (Windows 200 server), copied over the unzipped files into DesktopModules/showmessages.

I followed the instructions and it didn't work.

But I noticed something. I was keying in a key for the View module. I took it out. Presto it worked.

So, like I suspected I was NOT following the instructions.

Seems like the default View MUST have a blank key.

Went back to the XP machine, modified the definition and all kinds of them showed up, doubled up , everything I had tried.

Cleaned up by deleting everything from my test page, now they all work.

So the bottom line is, I was keying in a KEY for the default View type control, and it won't show anything if you do that. I suspect it actually works, though, because if you do this:

Define a module with something in the key for the default view type control. Add it to a test page. Nothing shows up.

Go back to module definition, delete the key for the default view control. Go back to the same test page: Add it again. Two of them show up.

Thanks for all your help. I would have given up long ago. Now I'm headed for the hard part, building my own modules. Hope I can figure out how to add my code. I'm only a novice at ASp.net even though 'certified'. I have been programming in VB since VB3, Access since forever, SQL server since 97, so it's the .net part that is new. And DNN is great but foreign to me.

Sorry if I messed up a great thread you had started about the notepad version, which one can screw up in exactly the same way as I did. If you want to move all this stuff out that's ok by me.

thanks again
Phil

0
PhilM99
9/29/2005 2:20:44 PM
Great!

Glad you got it working. You actually ended up giving my "Notepad" site a lot of hits by reactivating this thread so thanks for that.

SilverlightDesktop.net

A framework that allows you to dynamically load Silverlight modules into resizable draggable windows.
0
adefwebserver
9/29/2005 6:23:27 PM
Reply: