DotNetNuke Custom Module Creation Using DNNTemplate

Software Requirement

  1. Visual Studio 2012 Express
  2. SQL Server Express
  3. DotNetNuke Module Template for 2012 ( DNNTemplates )

Setup

  1. Install Visual Studio Express if you haven't already done it.
  2. Install SQL Server Express if you haven't already done it.
  3. Install DNNTemplates.

Steps To Create a Custom Module

  1. Open Visual Studio 2012.
    Go to File, New, then Project,
    Custom Module
  2. Select Appropriate Module Template form installed template. Specify Appropriate Module name and Folder location.
    Module Template
  3. Click the OK button. It starts creating the project and at the end, it shows the following error message.
    Error
  4. To resolve this error, we need to make changes in the solution file of the created module.
    Click TestingModule.csproj file in Visual Studio.
  5. Make the following changes in the TestingModule.csproj file.
    <IISUrl>http://localhost/DNN/desktopmodules/TestingModule</IISUrl>
    <IISAppRootUrl>http://localhost/DNN/</IISAppRootUrl>
    
    <ProjectExtensions>
        <VisualStudio>
            <FlavorProperties GUID="{31-65df-11da-9384-00065123321}">
                <WebProjectProperties>
                    <UseIIS>True</UseIIS>
                    <AutoAssignPort>False</AutoAssignPort>
                    <DevelopmentServerPort>0</DevelopmentServerPort>
                    <DevelopmentServerVPath>
                    </DevelopmentServerVPath>
                    <IISUrl>http://localhost/DNN/desktopmodules/TestingModule</IISUrl>
                    <OverrideIISAppRootUrl>True</OverrideIISAppRootUrl>
                    <IISAppRootUrl>http://localhost/DNN/</IISAppRootUrl>
                    <NTLMAuthentication>False</NTLMAuthentication>
                    <UseCustomServer>False</UseCustomServer>
                    <CustomServerUrl>
                    </CustomServerUrl>
                    <SaveServerSettingsInUserFile>False</SaveServerSettingsInUserFile>
                </WebProjectProperties>
            </FlavorProperties>
        </VisualStudio>
    </ProjectExtensions>
    
  6. Open a separate instance of a custom module project in a separate visual studio, so that we make coding changes.
    Coding changes
  7. Steps to build a complete DotNetNuke project along with a custom module.
    • Build TestingModule Project.
    • Rebuild the Main Solution of the DotNetNuke Project.
    • Run the solution in VS 2012.
    • Login into the DotNetNuke application.
    DotNetNuke application
  8. Sign in to DotNetNuke.
    DotNetNuke

Integration of custom module in DotNetNuke project

  1. Run SQL Script.
    • Go to the TestingModule Folder in Main Solution.
    • Go to Providers, DataProviders, SqlDataProvider - 00.00.01.SqlDataProvider.
    • Click 00.00.01.SqlDataProvider file having SQL queries.
    • Go to Host -> SQL.
    • Paste the SQL query in the following window.
      SQL query
  2. Add Custom Module.
    1. Go to Host -> Extension.
    2. Select Create New Module.
      Extension
  3. Select the appropriate option to create a new Custom module. Click the Create Module button.
  4. After the Custom module is created, it shows the newly created module on the extension page.
  5. Test Page added into the application.
    Test Page added
  6. Add Module on the test page as follows.
    • Go to Module -> Add New Module.
    • Drag and drop the module on the test page.
    • When the settings are correct, it will show you the ‘add item’ option on the test page.
      Add item
  7. In case some settings are incorrect, it will not show you the add item option on a test page, in that case, we need to change your setting of the Custom module.
    • Go to Host -> Extension.
    • Go to the custom module we added to the list.
    • Select the Edit option.
    • Please check the Module Control section properly as shown in the figure.
      Module Control section

Happy coding!


Similar Articles