Creating a new Module for a DotNetNuke Portal

A guide to setup a new module using DotNetNuke 5.6.3 framework in Microsoft Visual Studio 2010. Included are screenshots and brief descriptions of each step.

Part I Adding the module to your visual studio environment.
Open Visual Studio and open your project

1. Select the root project folder.

2. While the root folder is selected browse to Select File > New > File

3. The screen below will appear. Select your language of choice (VB / C#) and select DotNetNuke Dynamic Module. Enter the name you want to use for your module. In this example I will be using the name ExampleModule. Click Add.
4. Two folders have been created. We have to rename them to what we named our project in the previous step. (ExampleModule for me) In your solution explorer Browse to App_Code which is located in your root directory. Inside of the App_Code folder a new folder named “ModuleName” has been created. Right click the folder and rename it to what you named your Module.(ExampleModule)

5. Now do the same with the folder named ModuleName located in the DesktopModules folder, which is also located in the root directory.

6. DotNetNuke automatically prepends your NameSpace name for each new module you create with “Philip.Modules” so change it to something more relavent such as PortalName.Modules.ExampleModule by doing a Find and Replace( press CTRL+H) and tell it to look in the whole project. Then press Replace All.

7. Now we must make sure that the module is compiled correctly, so in your root folder open webconfig. Once webconfig is open, under </buildProviders> add the following with your module name:
<add directoryName="ExampleModule"/>
(If this is not a new project codeSubDirectories might exist so just add the new directory name)

8. Open up ViewExampleModule.ascx and delete the datalist that was automatically created.

9. Now, Open ViewExampleModule.ascx.cs and delete the following code:
Protected void lstConttent….
And then delete everything INSIDE of Page_Load

10. Press Build!

Congratulations you’ve just created your own Module for DotNetNuke.

Part II Adding your created module to your DotNetNuke portal.

1. Once you have completed Part I of this guide you should be able to run your portal. So go ahead and press the  play button or (F5)
2. Your portal should start up. Login and browse to Host > Module Definitions

3. Make sure your Mode in the top Ribbonbar is in Edit or you will not be able to perform the next step

4. Hover your mouse over the arrow near Module Definitions, and Select Create New Module from the menu.

5. Choose Create Module from Control and enter the following respective information. Leave owner folder as <Not Specified>

6. Head over to your Test Module Page (only viewable while logged in as admin) and you will see your blank module. You’re now ready to start coding!
Congratulations you’ve just added your own Module to your DotNetNuke Portal!
You can begin coding now!

By Ben Budnevich   Popularity  (5762 Views)