Professional DotNetNuke 4: Open Source Web Application Framework for ASP.NET 2.0 (Programmer to Programmer) (Paperback)

dotnetnuke forum

DotNetNuke 4.0.0 Starter Kit and Templates...  

Simple tutorials

DAL and DAL+ general description


BlankModule Solution  

DotNetNuke SolPart Menu Uncovered   + many different articles

Building and using a 3-tiered data architecture with ASP.NET 2.0 Not exactly DNN...

Stored Procedure:

ALTER Procedure BrowserInfo2_IPCount
FROM Creations_BrowserInfo2

BLL Function:

Public Shared Function BrowserInfo2_IPCount() As Integer
   Return CType(DataProvider.Instance().ExecuteScalar("BrowserInfo2_IPCount"), Integer)
End Function

Set Module Title in code [4.3.5]

ModuleConfiguration.ModuleTitle = "New Title"


ModuleConfiguration.ModuleTitle = Session("MYNAME") & " Item Inventory Report"

What you're missing is it has to be in Page_Init.  Page_Load is too late.

Check Roles and privelages

   If UserInfo.IsSuperUser Then
     Label1.Text = "User has Host Privs (Super User)"
   ElseIf UserInfo.IsInRole("Administrators") Then
     Label1.Text = "User is an Administrator"
   ElseIf IsEditable Then
     Label1.Text = "User has Edit privs"
   ElseIf UserId = -1 Then
     Label1.Text = "User is viewing Anonymously"
     Label1.Text = "User has no privs"
   End If

Paging in GridView:

Sub TabsGridView_PageIndexChanging(ByVal sender As Object, ByVal e As GridViewPageEventArgs)
End Sub

module using X tables/dataproviders

Imports System

Imports System.Web.Caching

Imports System.Reflection

Namespace myCompany.DNN.Modules.myCompanyUtil.Data

Public MustInherit Class DataProvider

#Region "Shared/Static Methods"

' singleton reference to the instantiated object

Private Shared objProvider As DataProvider = Nothing

' constructor

Shared Sub New()


End Sub

' dynamically create provider

Private Shared Sub CreateProvider()

objProvider = CType(Framework.Reflection.CreateObject("data", "myCompany.DNN.Modules.myCompanyUtil.Data", "myCompany.DNN.Modules.myCompanyUtil"), DataProvider)

End Sub

' return the provider

Public Shared Shadows Function Instance() As DataProvider

Return objProvider

End Function

#End Region

#Region "Abstract Methods"


' TODO Declare DAL methods. Should be implemented in each DAL DataProvider

' Use CodeSmith templates to generate this code


Public MustOverride Function ListTable1() As IDataReader

Public MustOverride Function ListTable2() As IDataReader

Public MustOverride Function ListTable3() As IDataReader

Public MustOverride Function InsertTable1() As Integer

Public MustOverride Function InsertTable2() As Integer

Public MustOverride Function InsertTable3() As Integer

Public MustOverride Function UpdateTable1() As Integer

Public MustOverride Function UpdateTable2() As Integer

Public MustOverride Function UpdateTable3() As Integer

#End Region

End Class

End Namespace

using the Microsoft Application Blocks Data

public override int AddItem(IDbTransaction trans, int PARAM1, int PARAM2)

{return Convert.ToInt32(SqlHelper.ExecuteScalar((SqlTransaction)trans, DatabaseOwner + ObjectQualifier + "SQLPROCEDURE", PARAM1, PARAM2));}

The stored proc at the end looks like



Getting NavigateURL() to Work

1.  Create a default holding control (primary view control for the module).  This control will be used for all of the switching of view controls.  It has only one server control on it:

=asp:PlaceHolder id="plhControls" runat="Server" /=

2.  Send a querysting variable to the tab to specify which view control to load.  Use the following code to reference the desired control:

Private m_controlToLoad As String

Private Sub ReadQueryString()
    If Not (Request("ControlType") Is Nothing) Then
        Select Case Request("ControlType").ToLower()
            Case "sales"
                m_controlToLoad = "SalesSummary.ascx"
            Case "orders"
                m_controlToLoad = "OrdersSummary.ascx"
            Case Else
                m_controlToLoad = "SalesSummary.ascx"
        End Select
        m_controlToLoad = "SalesSummary.ascx"
    End If
End Sub

3.  Load the control through code, as follows:

Private Sub LoadControlType()
     Dim objPortalModuleBase As PortalModuleBase = CType(Me.LoadControl(m_controlToLoad), PortalModuleBase)
     If Not (objPortalModuleBase Is Nothing) Then
          objPortalModuleBase.ModuleConfiguration = Me.ModuleConfiguration
          objPortalModuleBase.ID = System.IO.Path.GetFileNameWithoutExtension(m_controlToLoad)
     End If
End Sub

4.  Fire these two routines each time the page initializes:

Private Sub Page_Init(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Init
     'CODEGEN: This method call is required by the Web Form Designer
     'Do not modify it using the code editor.
End Sub

5.  In order to switch to another control, place this code in the desired event:

Response.Redirect(NavigateURL() + "&ControlType=orders")