What is a DotNetNuke Module?
In order to understand what a
DotNetNuke module is, it is important to first understand what
DotNetNuke is.
DotNetNuke is a Framework
DotNetNuke is a program that runs on Microsoft ASP.NET. It is also a framework, meaning, it is a program that is designed to be extended. One of the ways you extend the framework is to create modules. These modules are installed inside a
DotNetNuke DNN4 Module Developers Guide
A single
DotNetNuke installation will allow the creation of thousands of individual portals (as much as the server hardware can handle).
DotNetNuke portals are configured to display pages and the pages are configured to display modules.
Here I will give you a simple example of making a module in dotnetnuke and implementing it i your DOTNETNUKE application.
To make an application you need:
- Visual Studio Express (download)
- SQL Server Express (download)
- DotNetNuke (download)
Open your DotNetNuke website in Visual Studio.
Right-click on the "
DesktopModules" folder and select "
New Folder"
Name the folder "
SuperSimple"
Next, right-click on the "
SuperSimple" folder and select "
Add New Item..."
In the "
Add New Item" box that opens:
- Click on "Web User Control" under "Visual Studio Installed Templates".
- Enter "SuperSimple.ascx" in the "Name" box.
- Make sure the "Place code in a separate file" box is checked.
- Click the "Add" button.
- The "SuperSimple.ascx" file will be created in the "SuperSimple" folder under the "DesktopModules" folder.
Clicking the "plus" icon next to the file will display the associated code behind file "
SuperSimple.ascx.vb" (or "
SuperSimple.ascx.cs").
Double-click on the "
SuperSimple.ascx" file and it will open up in the main editing window. Right now the page will be blank.
Click the "Source" button at the bottom of the page to switch to source view.
Enter the following code:
C#:
<%@ Control Language="C#" AutoEventWireup="true" CodeFile="SuperSimple.ascx.cs" Inherits="DesktopModules_SuperSimple_SuperSimple" %> Search: <asp:TextBox ID="txtSearch" runat="server">asp:TextBox> <asp:Button ID="btnSearch" runat="server" Text="Button" OnClick="btnSearch_Click" /><br /> <br /> <asp:GridView ID="GridView1" runat="server"> asp:GridView> |
Click the "
Design" button at the bottom of the page to switch to the design view.
Double-click on
SuperSimple.ascx.cs
Replace all the code with the following code:
using DotNetNuke;
using System.Web.UI;
using System.Text;
using System.Collections.Generic;
using System.Reflection;
using DotNetNuke.Security;
using System.Data.SqlClient;
using System.Data;
using DotNetNuke.Data;
partial class DesktopModules_SuperSimple_SuperSimple : DotNetNuke.Entities.Modules.PortalModuleBase
{
protected void Page_Load(object sender, System.EventArgs e) {
if (!Page.IsPostBack)
{
ShowData("");
}
}
protected void btnSearch_Click(object sender, System.EventArgs e) {
ShowData(txtSearch.Text);
}
private void ShowData(string SearchString) {
StringBuilder mySqlString = new StringBuilder();
mySqlString.Append("SELECT FriendlyName, Description ");
mySqlString.Append("FROM {databaseOwner}{objectQualifier}DesktopModules ");
mySqlString.Append("WHERE Description like \'%\' + @SearchString + \'%\' ");
mySqlString.Append("ORDER BY FriendlyName");
SqlParameter myParam = new SqlParameter("@SearchString", SqlDbType.VarChar, 150);
myParam.Value = SearchString;
this.GridView1.DataSource = ((IDataReader)(DataProvider.Instance().ExecuteSQL(mySqlString.ToString(), myParam)));
this.GridView1.DataBind();
}
}
Select
BUILD from the menu bar and select "
Build Page".
The page should build without errors.
While logged into your DotNetNuke site as "
host" in the web browser, from the menu bar select "
Host". Then select "
Module Definitions".
Click the black arrow that is pointing down to make the fly-out menu to appear. On that menu select "
Create New Module".
In the
Edit Module Definitions menu:
- Enter "SuperSimple" for MODULE NAME
- Enter "SuperSimple" for FOLDER TITLE
- Enter "SuperSimple" for FRIENDLY TITLE
- Enter "SuperSimple" for DESCRIPTION
- Enter "1.0" for VERSION
Then click UPDATE
Enter "SuperSimple" for NEW DEFINITION
Then click "Add"
Next, Click "Add Control"
In the Edit Module Control menu:
- Enter "SuperSimple" for TITLE
- Use the drop-down to select "DesktopModule/SuperSimple/SuperSimple.ascx" for SOURCE
- Use the drop-down to select "View" for TYPE
Then click UPDATE
In the upper left hand corner of the website, under the PAGE FUNCTIONS menu click ADD.
In the PAGE MANAGEMENT menu under PAGE DETAILS:
- Enter "SuperSimple" for PAGE NAME
- Enter "SuperSimple" for PAGE TITLE
- Enter "SuperSimple" for DESCRIPTION
- Click the VIEW PAGE box next to ALL USERS
Then click UPDATE
From the MODULE drop-down select "SuperSimple".
Then click ADD.
This is done and finally you will see your module on your site.
This is the most simple way to make a module in dotnetnuke and add it in your site
I have been searching for FREE SHOPPING CART module on internet bu I couldn't find one . So finally I made the module by my own.
If any one require this module then kindly contact me and I will mail the module to him/her.