开发者

How to create a simple Dotnetnuke module without DAL

I've been looking for ways to do this for days now ... and its really killin' me ... anyone, please help.

I want to create a new module in DNN (VB) ... that;

1. does not use DAL or DAL+
2. has only one view.ascx control
3. It has to be a compiled module

I do not need DB connectivity and any bells and whistles just one view control. I thought it would be simple but googling for a day now and 开发者_开发百科it seems very complicated.

Anyone willing to post a step by step ... would be great...

I have the development environment already set up with;
1. DNN Starter kit
2. VS 2008
3. SQL server
4. DNN up and running in IIS
5. the project builds successfully

If anyone knows a way I can build a module using the DNN Dynamic Module Template in VS 2008 and then strip off the DAL and all the unnecessary layers and extra controls until I have only a working view.ascx that just prints out "Hello World!" to the screen ... that would be great !

Thanks a whole bunch, Norman.

P.S : (I've also tried the hello world tutorial at adefwebserver.com (http://www.adefwebserver.com/DotNetNukeHELP/DNN5_HelloWorld/Default.htm)- and that wizard does'nt show up as it does in the tutorial.)


When first learning the ropes, I'd suggest writing it from scratch and skipping all of the template, ahem, junk.

Here are the basic steps:

  1. Create a new Visual Studio "ASP.NET Web Application" project, I outlined the basic configuration settings for a web application project in a blog post awhile back: Creating DotNetNuke Modules using a Web Application Project (WAP)
  2. Add a reference to the DotNetNuke.dll
  3. Add a new Web User Control (.ascx) file - call it View.ascx.
  4. Make sure the user control inherits from PortalModuleBase (see below). Fill it out with some sample hello world code (again, see below)
  5. You can import this user control (by itself) into DNN. In DNN 5, select "Create New Module" from the host -> module definitions page.
  6. You can then export the module package, if desired, from the Host -> Module Definitions or Host -> Extensions page (keep in mind though, you need to be running locally in order to export the package, it won't let you do it if you're on a remote server or something)

View.ascx:

<%@ Control Language="vb" AutoEventWireup="false" CodeBehind="View.ascx.vb" Inherits="HelloWorld.View" %>

<h1><asp:Literal ID="PageHeaderText" runat="server" /></h1>

View.ascx.vb:

Imports DotNetNuke.Entities.Modules

Partial Public Class View
    Inherits PortalModuleBase

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        If Not Page.IsPostBack Then
            PageHeaderText.Text = "Hello World"
        End If
    End Sub

End Class
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜