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.0Switch to another module via EditURLSwitch to another module via EditURL
Previous
 
Next
New Post
11/18/2008 11:36 AM
 

Say I have three modules, one called Servers, another called Installations, and a third called Software. Installations uses lookups to note where installations are done and where they are done. Relationship is Software -> installations <- Servers. I would like to have a URL on the datalist that would allow you to click on the software title and have you link to the Installation module and display the list of places that is installed by passing the softwareid, likewise I'd like to have the datalist of the Server where you click on the server name and get a list of what's installed there by passing the serverid.

This is fairly trivial to do but using the controlid if I merge the three modules together into one and rename the various View, Edit, and consolidate the settings. I'd like to avoid that. Any suggestions about the best way to retrive the module ID for a module to use in populating the EditURL (or NavigateURL) taking into account there may (remote possibility) be more than one instance of that control. All these controls are portal centric.

I am thinking the most practical way would be to retrieve the list of installations / tabid  and have that as a setting so the lookup doesn't take place repeaitdly, but the most "practical"way to populate a list with page names where the module is isntalled would be apprciated as well as examples of doing that with Edit/NavigateURL if possible.

 
New Post
11/18/2008 2:12 PM
Accepted Answer 

I have used the following code a number of times for obtaining a list of all tab names/module titles for a specific module by module name:

Public Class InstalledModule
   Private _TabId As Integer
   Private _TabName As String
   Private _ModuleId As Integer
   Private _ModuleTitle As String
   Private _Selected As Boolean = False

   Public ReadOnly Property TabId() As Integer
      Get
         Return _TabId
      End Get
   End Property

   Public ReadOnly Property TabName() As String
      Get
         Return _TabName
      End Get
   End Property

   Public ReadOnly Property ModuleId() As Integer
      Get
         Return _ModuleId
      End Get
   End Property

   Public ReadOnly Property ModuleTitle() As String
      Get
         Return _ModuleTitle
      End Get
   End Property

   Public Property Selected() As Boolean
      Get
         Return _Selected
      End Get
      Set(ByVal value As Boolean)
         _Selected = value
      End Set
   End Property

   Public Sub New(ByVal TabId As Integer, ByVal TabName As String, ByVal ModuleId As Integer, ByVal ModuleTitle As String)
      _TabId = TabId
      _TabName = TabName
      _ModuleId = ModuleId
      _ModuleTitle = ModuleTitle
   End Sub
End Class

Public Function GetInstalledModulesByName(ByVal ModuleName As String, ByVal PortalId As Integer) As Generic.List(Of InstalledModule)
   Dim installedModules As New Generic.List(Of InstalledModule)
   Dim dmc As New Entities.Modules.DesktopModuleController
   Dim dmi As Entities.Modules.DesktopModuleInfo = dmc.GetDesktopModuleByModuleName(ModuleName)
   If Not dmi Is Nothing Then
        Dim mc As New Entities.Modules.ModuleController
        Dim tc As New Entities.Tabs.TabController
        For Each mi As Entities.Modules.ModuleInfo In mc.GetModulesByDefinition(PortalId, dmi.FriendlyName)
             Dim ti As Entities.Tabs.TabInfo = tc.GetTab(mi.TabID, PortalId, True)
             If Not ti.IsDeleted AndAlso ti.IsVisible Then
                  installedModules.Add(New InstalledModule(mi.TabID, ti.TabName, mi.ModuleID, mi.ModuleTitle))
             End If
        Next
   End If
   Return installedModules
End Function

Since a module's FriendlyName is subject to change, I include the extra step of obtaining the (current) FriendlyName from the DesktopModuleInfo object which is retrieved based on the ModuleName (which does not change).

You may also want to add checks on tab and/or module permissions before adding a module instance to the returned list. The returned Generic.List (Of InstalledModule) may then be used to bind a datagrid, etc. from which one or more module instances could be selected by the user.

Definitely populate the list and store the selection(s) only on a settings page - not repeatedly as obtaining the list is a fairly expensive operation performance wise.


Bill, WESNet Designs
Team Lead - DotNetNuke Gallery Module Project (Not Actively Being Developed)
Extensions Forge Projects . . .
Current: UserExport, ContentDeJour, ePrayer, DNN NewsTicker, By Invitation
Coming Soon: FRBO-For Rent By Owner
 
New Post
11/19/2008 9:23 AM
 

Thank you very much, just what I needed. I made a few changes to complete my implementation.

I added one property to installedmodules.vb because I needed to have both tab and module.

    Public ReadOnly Property ModuleTitle() As String

        Get
            Return _ModuleTitle

        End Get

    End Property

The Setting.ascx.vb has this in LoadSettings:

                    Dim objVendorModule As SoftwareController = New SoftwareController
                    txtVendorModule.DataSource = objVendorModule.GetInstalledModulesByName("Vendor", PortalId)
                    txtVendorModule.DataTextField = "TabName"
                    txtVendorModule.DataValueField = "TabModule"
                    If CType(TabModuleSettings("vendormodule"), Int32) > 0 And _
                       CType(TabModuleSettings("vendortab"), Int32) > 0 Then
                        txtVendorModule.Text = CType(TabModuleSettings("vendortab"), String) & "/" & CType(TabModuleSettings("vendormodule"), String)
                    End If
                    txtVendorModule.DataBind()

and this in SaveSettings:

                Dim intTabId As Int32
                Dim intModuleId As Int32
                Dim strTabModule() As String

                strTabModule = txtVendorModule.Text.Split("/")
                intTabId = System.Convert.ToInt32(strTabModule(0))
                intModuleId = System.Convert.ToInt32(strTabModule(1))

                If intTabId > 0 Then
                    objModules.UpdateTabModuleSetting(TabModuleId, "vendortab", intTabId.ToString)
                Else
                    objModules.DeleteModuleSetting(TabModuleId, "vendortab")
                End If

                If intModuleId > 0 Then
                    objModules.UpdateTabModuleSetting(TabModuleId, "vendormodule", intModuleId.ToString)
                Else
                    objModules.DeleteModuleSetting(TabModuleId, "vendormodule")
                End If

I added this to the itemdatabase event of the DataList :

                    If CType(Settings("vendormodule"), Int32) > 0 And CType(Settings("vendortab"), Int32) > 0 Then
                        Dim hypVendorId As HyperLink = CType(e.Item.FindControl("hypVendorId"), HyperLink)
                        hypVendorId.NavigateUrl = NavigateURL(CType(Settings("vendortab"), Int32), "ViewSingleVendor", _
                                                              "mid=" & CType(Settings("vendormodule"), String), _
                                                              "VendorId=" & intVendorId.ToString)
                        hypVendorId.Visible = True
                        hypVendorId.Text = strVendorId.ToString
                    Else
                        Dim lblVendorId As Label = CType(e.Item.FindControl("lblVendorId"), Label)
                        lblVendorId.Text = strVendorId.ToString
                        lblVendorId.Visible = True
                    End If

 

 
Previous
 
Next
HomeHomeArchived Discus...Archived Discus...Developing Under Previous Versions of .NETDeveloping Under Previous Versions of .NETASP.Net 2.0ASP.Net 2.0Switch to another module via EditURLSwitch to another module via EditURL


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