This blog is no longer being updated because I have moved it from WordPress over to my own DotNetNuke site, so please head over to http://www.dnnsecrets.co.uk where I also aggregate some of the best DotNetNuke blogs available.
What do you need to do to create a “HelloWorld” DotNetNuke (DNN) module?
1) Set up your development environment
2) Under DesktopModules create a folder called HelloWorld
3) Create a HelloWorld.dnn file, containing:
<dotnetnuke version=”3.0″ type=”Module”>
<folders>
<folder>
<name>DNNSecrets.HelloWorld</name>
<friendlyname>HelloWorld</friendlyname>
<foldername>DNNSecrets.HelloWorld</foldername>
<modulename>DNNSecrets.HelloWorld</modulename>
<description>A HelloWorld module</description>
<version>01.00.00</version>
<modules>
<module>
<friendlyname>HelloWorld</friendlyname>
<cachetime>60</cachetime>
<controls>
<control>
<src>DesktopModules/HelloWorld/ViewHelloWorld.ascx</src>
<type>View</type>
<helpurl></helpurl>
</control>
</controls>
</module>
</modules>
<files>
<file>
<name>ViewHelloWorld.ascx</name>
</file>
<file>
<name>ViewHelloWorld.ascx.vb</name>
</file>
</files>
</folder>
</folders>
</dotnetnuke>
Keeping things to the bare minimum, we only reference the ViewHelloWorld.ascx and its code behind file ViewHelloWorld.acsx.vb.
4) Create a ViewHelloWorld.ascx file containing:
<%@ Control language=”vb” Inherits=”DNNSecrets.Modules.HelloWorld.ViewHelloWorld” CodeFile=”ViewHelloWorld.ascx.vb” AutoEventWireup=”false” Explicit=”True” %>
HelloWorld
and also the ViewHelloWorld.ascx.vb
Imports DotNetNuke
Imports System.Web.UI
Imports System.Collections.Generic
Imports System.ReflectionNamespace DNNSecrets.Modules.HelloWorld
Partial Class ViewHelloWorld
Inherits Entities.Modules.PortalModuleBasePrivate Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
End SubEnd Class
End Namespace
5) So now you should have a folder structure looking like this:
And the files should contain the content as described in steps 3 to 5 above.
6) Finally we can now install the module – to do this simply load up your DNN web site, login as host and go to the “Module Definitions” page. At the bottom of the page click the “Import Module Definition” link and then select the HelloWorld.dnn file from the Manifest Drop Down List and click “Import Manifest”.
That’s it! You have now created your first “HelloWorld” DotNetNuke Module!
[Edit] – Thanks Michael, the Resx file has been removed from this tutorial – so now it is “Create A HelloWorld Module In 6 Easy Steps”.
Filed under: DotNetNuke Development
Small variation:
First i would follow your instructions in
1) 2) 4) 5)
Next step would be
a) create a module:
a1)
->host->modules->create module definition
Set up module name, foldername, friendly name to “Hello World”, click create
a2) New definition “helloworld” (any name will do), click on add definition. Click on add control, Select helloworld/ViewHelloWorld.ascx for source.
–your module is ínstalled now and ready to run—
b) Create module package
->host->modules->edit helloworld module
click on “Create Module package”
enable Create Manifest File
click on create.
Your module is now packed in /install/modules/.
it’s good example but the designer is locked and i want to add some controls on the page, how could do that??
Second on is very good & easy example
1St i wanna tell thanks nice article in past i had work on Dnn but after long time i got new project in Dnn when i check it latest version is change completely and i stuck in PROBLEM how to create module in this new version
Followed the steps 1-6, then followed Stephan’s steps.. neither worked for 4.08.. is there a tutorial for 4.08?
The fastest and most flexible way of creating your own Dotnetnuke modules is by creating a WAP project. You can find more info on how to do that here(http://www.adefwebserver.com/DotNetNukeHELP/DNN4_WAP) Building you module this way offers you the ability to name you assembly file and you can build just the module and not the entire dotnetnuke web so it is also much faster to work with while building.
[...] Create a HelloWorld DotNetNuke Module In 6 Easy Steps [...]
I m getting an error while trying to put that module on my page.
it says…
Error: HelloWorld is currently unavailable.
DotNetNuke.Services.Exceptions.ModuleLoadException: Unable to cast object of type ‘ASP.desktopmodules_helloworldmodule_webusercontrol_ascx’ to type ‘DotNetNuke.Entities.Modules.PortalModuleBase’. —> System.InvalidCastException: Unable to cast object of type ‘ASP.desktopmodules_helloworldmodule_webusercontrol_ascx’ to type ‘DotNetNuke.Entities.Modules.PortalModuleBase’. at DotNetNuke.UI.Skins.Skin.InjectModule(Control objPane, ModuleInfo objModule, PortalSettings PortalSettings) in C:\DNN\DotNetNuke\Library\Components\Skins\Skin.vb:line 492 — End of inner exception stack trace —
Cool!! Much Obliged
Hi,
This a great stuff keep it up post more like this thanks
Cool! Can you do an skin object HelloWorld?
Hi,
Great article to start with…
Do you have a sample module for DNN 5.0 wherein when you install it, a submenu under admin/host will be automatically created for the module you’ve installed.
Thanks!
I was looking for more explanatory and step by step information on how to add blog module in DNN, really well explained. I went through many websites and found this very helpful; easy to undertsand.