Products

Solutions

Resources

Partners

Community

Blog

About

QA

Ideas Test

New Community Website

Ordinarily, you'd be at the right spot, but we've recently launched a brand new community website... For the community, by the community.

Yay... Take Me to the Community!

Welcome to the DNN Community Forums, your preferred source of online community support for all things related to DNN.
In order to participate you must be a registered DNNizen

HomeHomeArchived Discus...Archived Discus...Developing Under Previous Versions of .NETDeveloping Under Previous Versions of .NETASP.Net 2.0ASP.Net 2.0Module navigation QuestionModule navigation Question
Previous
 
Next
New Post
7/24/2007 7:15 PM
 

I am not real clear on your control hierarchy.  However it is possible you are loading a sub control that doesn't know anything about the DNN environment (even if it inherits PortalModuleBase).  If this is the problem there are a couple of ways to get what you need.  You can assign your control DNN values as you load them or find the parent module when needed.

Here's some code to find the parent module when needed:

Public Class MyControlBase

        Inherits System.Web.UI.UserControl

 

Private _ParentObjectModule as DotNetNuke.Entities.Modules.PortalModuleBase

 Protected ReadOnly Property ParentModule() As DotNetNuke.Entities.Modules.PortalModuleBase
            Get

                If _ParentObjectsModule Is Nothing Then
                    _ParentObjectsModule = Me.FindMyModuleObject(Me)
                End If
                Return _ParentObjectsModule

            End Get
        End Property


        Protected Function FindMyModuleObject(ByVal ctl As Web.UI.Control) As System.Web.UI.Control


            If Not ctl Is Nothing Then
                If TypeOf ctl Is DotNetNuke.Entities.Modules.PortalModuleBase Then
                    Return ctl
                Else
                    Return FindMyModuleObject(ctl.Parent)
                End If
            Else
                Return ctl
            End If

        End Function

End Class

 

Then in your control when you need ModuleID (or anything from the module) you can:

if ParentModule is nothing then

' Something is wrong

else

'Use ParentModule.ModuleID....

end if

 
New Post
7/24/2007 7:36 PM
 

As a novice module developer I don't know where to put this.  The codebehind of my custom module looks like the following. Would it go in there? 

Imports DotNetNuke
Imports DotNetNuke.Common
Imports DotNetNuke.Security.PortalSecurity
Imports System.Web
Imports System.Web.UI
Imports System.Web.UI.WebControls
Imports System
Imports System.Data
Imports System.Text
Imports Microsoft.VisualBasic
Imports Microsoft.ApplicationBlocks.Data

Namespace jdpaskett.Modules.PatchTracker
Public Class ucCriteria
Inherits DotNetNuke.Entities.Modules.PortalModuleBase

< _
Browsable(True), _
Bindable(False), _
PersistenceMode(PersistenceMode.Attribute) _
> _
Public Custom Event SelectionChanged As EventHandler
AddHandler(ByVal value As EventHandler)
AddHandler ddlOS.SelectedIndexChanged, value
AddHandler ddlSP.SelectedIndexChanged, value
AddHandler ddlFileName.SelectedIndexChanged, value
End AddHandler

RemoveHandler(ByVal value As EventHandler)
AddHandler ddlOS.SelectedIndexChanged, value
AddHandler ddlSP.SelectedIndexChanged, value
AddHandler ddlFileName.SelectedIndexChanged, value
End RemoveHandler

RaiseEvent(ByVal sender As Object, ByVal e As System.EventArgs)
' nothing to do here
End RaiseEvent
End Event

< _
Browsable(True), _
Bindable(True, BindingDirection.TwoWay), _
PersistenceMode(PersistenceMode.Attribute) _
> _
Public Property PatchListID() As String
Get
Return lblPatchListID.Text
End Get
Set(ByVal value As String)
lblPatchListID.Text = value
End Set
End Property

< _
Browsable(True), _
Bindable(True, BindingDirection.TwoWay), _
PersistenceMode(PersistenceMode.Attribute) _
> _
Public Property OperatingSystemID() As String
Get
Return ddlOS.SelectedValue
End Get
Set(ByVal value As String)
ddlOS.SelectedValue = value
End Set
End Property

< _
Browsable(True), _
Bindable(True, BindingDirection.TwoWay), _
PersistenceMode(PersistenceMode.Attribute) _
> _
Public Property VersionID() As String
Get
Return ddlSP.SelectedValue
End Get
Set(ByVal value As String)
ddlSP.SelectedValue = value
End Set
End Property

< _
Browsable(True), _
Bindable(True, BindingDirection.TwoWay), _
PersistenceMode(PersistenceMode.Attribute) _
> _
Public Property FileListID() As String
Get
Return ddlFileName.SelectedValue
End Get
Set(ByVal value As String)
ddlFileName.SelectedValue = value
End Set
End Property

< _
Browsable(True), _
Bindable(True, BindingDirection.TwoWay), _
PersistenceMode(PersistenceMode.Attribute) _
> _
Public Property FileVersion() As String
Get
Return txtFileVersion.Text
End Get
Set(ByVal value As String)
txtFileVersion.Text = value
End Set
End Property

< _
Browsable(True), _
Bindable(True, BindingDirection.TwoWay), _
PersistenceMode(PersistenceMode.Attribute) _
> _
Public Property FileCreateDate() As String
Get
Return txtFileCreateDate.Text
End Get
Set(ByVal value As String)
txtFileCreateDate.Text = value
End Set
End Property

< _
Browsable(True), _
Bindable(True, BindingDirection.TwoWay), _
PersistenceMode(PersistenceMode.Attribute) _
> _
Public Property FileModifiedDate() As String
Get
Return txtFileModifiedDate.Text
End Get
Set(ByVal value As String)
txtFileModifiedDate.Text = value
End Set
End Property

< _
Browsable(True), _
Bindable(True, BindingDirection.TwoWay), _
PersistenceMode(PersistenceMode.Attribute) _
> _
Public Property UseFileCreateDate() As String
Get
Return chkUseFileCreateDate.Checked
End Get
Set(ByVal value As String)
chkUseFileCreateDate.Checked = value
End Set
End Property

< _
Browsable(True), _
Bindable(True, BindingDirection.TwoWay), _
PersistenceMode(PersistenceMode.Attribute) _
> _
Public Property UseFileModifiedDate() As String
Get
Return chkUseFileModifiedDate.Checked
End Get
Set(ByVal value As String)
chkUseFileModifiedDate.Checked = value
End Set
End Property

< _
Browsable(True), _
Bindable(True, BindingDirection.TwoWay), _
PersistenceMode(PersistenceMode.Attribute) _
> _
Public Property FailIfFound() As String
Get
Return chkFailIfFound.Checked
End Get
Set(ByVal value As String)
chkFailIfFound.Checked = value
End Set
End Property

< _
Browsable(True), _
Bindable(True, BindingDirection.TwoWay), _
PersistenceMode(PersistenceMode.Attribute) _
> _
Public Property PassIfNotFound() As String
Get
Return chkPassIfNotFound.Checked
End Get
Set(ByVal value As String)
chkPassIfNotFound.Checked = value
End Set
End Property

< _
Browsable(True), _
Bindable(True, BindingDirection.TwoWay), _
PersistenceMode(PersistenceMode.Attribute) _
> _
Public Property MustEqual() As String
Get
Return chkMustEqual.Checked
End Get
Set(ByVal value As String)
chkMustEqual.Checked = value
End Set
End Property

Protected Sub ddlOS_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles ddlOS.SelectedIndexChanged
ddlFileName.DataBind()
If ddlOS.SelectedIndex > "0" And ddlSP.SelectedIndex > "0" Then
ddlFileName.Items.Add("New")
End If

End Sub

Protected Sub ddlSP_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles ddlSP.SelectedIndexChanged
ddlFileName.DataBind()
If ddlOS.SelectedIndex > "0" And ddlSP.SelectedIndex > "0" Then
ddlFileName.Items.Add("New")
End If
End Sub

Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
lblPatchListID.Text = Request.QueryString("PatchListID")

End Sub

Protected Sub ddlFileName_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles ddlFileName.SelectedIndexChanged
If ddlFileName.SelectedValue = "New" Then
Dim objModules As Entities.Modules.ModuleController = New Entities.Modules.ModuleController
Response.Redirect(NavigateURL(PortalSettings.ActiveTab.TabID, "AddFile", "mid=" & CStr(ModuleId)))
End If
End Sub
End Class
End Namespace

 
New Post
7/24/2007 8:27 PM
 

Hmm... Either I'm pointing you in the wrong direction or I am confused.  Is the code you posted for the module (or control) defined in module definitions?  Or is it the code for the custom user control with the 3 dropdown lists, etc?

 

 
New Post
7/24/2007 8:55 PM
 

I have a tendency to do that.   This code is from the module that actually contains the navigation to the AddRecord Module. The Edit module actually contains (or hosts) this module in the InsertItemTemplate of a FormView.  I put the code you suggested in the user control containing the navigation statements. Nothing errored out and the If statement you provided returned a value, so I changed the "mid=" & CStr(ModuleId) to "mid=" & CStr(ParentModule.ModuleId) but it still didn't work.

If you would be willing to look at the controls I have them zipped up and available here.

Jon

 

 
New Post
7/24/2007 9:03 PM
 

I have created a couple of module controls to a standard module:

  1. ViewModule (View)
  2. EditModule (Edit)
  3. AddRecord (Edit)

In the EditModule I simply add a Hyperlink that has a URL that is built with NavigateURL(TabID, "AddRecord","mid=" & Cstr(ModuleID)) and yet another Hyperlink with EditURL("AddRecord") -which in theory is exactly the same thing. Both work correctly. I will download and check your module with the DDLs.


Do you know the truth when you hear it?
Néstor Sánchez
The Dúnadan Raptor -->Follow Me on Twitter Now!
 
Previous
 
Next
HomeHomeArchived Discus...Archived Discus...Developing Under Previous Versions of .NETDeveloping Under Previous Versions of .NETASP.Net 2.0ASP.Net 2.0Module navigation QuestionModule navigation Question


These Forums are dedicated to discussion of DNN Platform and Evoq Solutions.

For the benefit of the community and to protect the integrity of the ecosystem, please observe the following posting guidelines:

  1. No Advertising. This includes promotion of commercial and non-commercial products or services which are not directly related to DNN.
  2. No vendor trolling / poaching. If someone posts about a vendor issue, allow the vendor or other customers to respond. Any post that looks like trolling / poaching will be removed.
  3. Discussion or promotion of DNN Platform product releases under a different brand name are strictly prohibited.
  4. No Flaming or Trolling.
  5. No Profanity, Racism, or Prejudice.
  6. Site Moderators have the final word on approving / removing a thread or post or comment.
  7. English language posting only, please.
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out