.NET Answers

ASP.NET, HTML, CSS, Visual Studio, CSharp, VB.NET and other programming items of interest.
Subscribe
  • Home
  • About Me
  • Advertising
  • Click Here to Ask a question
    • Privacy Policy
  • Site Map

DotNetNuke Modules – Finding The Page a Module is On

September 15, 2008 By: Dave

land-0127 Last week we talked a bit about Inter Module Communication, the ability of one module to notify another module on the page that something needs to happen without requiring a post back.  The other need you may have is something I refer to as Cross Page Communication.  This is not a DotNetNuke term, I just made it up today.

Here’s the problem.  In some cases, you may have a module that you’ve placed on a page that should only ever be on one page.  In my case, this was the checkout module.  I needed some way of retrieving the page that that module was on so that I could create a hyperlink to that page from my modules that displayed my products and my “mini cart” module that displayed a summary of items in the shopping cart.

Here’s how I did it:

// Find the tab the module specified by
//friendlyName, is on.

// ModuleController is in:
// DotNetNuke.Entities.Modules namespace
ModuleController moduleController =
    new ModuleController();

// User the friendlyName to find the moduleID
int myModuleDefId =
    Globals.GetDesktopModuleByName(friendlyName)
        .DesktopModuleID;

// Get all the tabs available for this portal.
ArrayList tabs = (new TabController())
    .GetTabs(portalId);
foreach (TabInfo ti in tabs)
{
    // For each page, find all the modules on the page
    Dictionary<int,ModuleInfo> modules =
        moduleController.GetTabModules( ti.TabID);
    foreach (ModuleInfo mi in modules.Values)
    {
        // If the module on the page is the module we
        // are looking for, return it.
        if (mi.DesktopModuleID == myModuleDefId)
        {
            return ti.TabID;
        }
    }
}

 

Other post in DotNetNuke - Module Development
  • Creating DotNetNuke Modules - May 20th, 2008
  • Creating DNN Modules - The Tools - May 22nd, 2008
  • DotNetNuke Modules - Foundational Concepts - May 26th, 2008
  • DotNetNuke Modules - Install DNN into VS 2008 - May 27th, 2008
  • DotNetNuke Modules - Creating Base Modules - May 28th, 2008
  • DotNetNuke Modules - Registering Your Module - May 29th, 2008
  • DotNetNuke Modules - Where Stuff Shows Up - June 3rd, 2008
  • DotNetNuke Modules - Benefits of Architecture - June 4th, 2008
  • DotNetNuke Modules - Anatomy of the View - June 9th, 2008
  • DotNetNuke Modules - Adding Actions - June 11th, 2008
  • DotNetNuke Modules - DNN Controls - Label - June 18th, 2008
  • DotNetNuke - Internationalization - June 25th, 2008
  • DotNetNuke Modules - Internationalization (part 2) - June 30th, 2008
  • DotNetNuke Modules - Labels w/ no Help - July 9th, 2008
  • DotNetNuke Modules - LinkButtons - July 14th, 2008
  • DotNetNuke Modules - Collapsible Panels - July 16th, 2008
  • DotNetNuke - The Data Layer - Installing CodeSmith - July 22nd, 2008
  • DotNetNuke - Modules - Creating The Tables - July 24th, 2008
  • DotNetNuke - Modules - Creating Stored Procs - July 29th, 2008
  • DotNetNuke - Modules - Portal Specific Modules - July 31st, 2008
  • DotNetNuke Modules - Data Access Layer - August 5th, 2008
  • DotNetNuke Modules - Data Access Layer - August 7th, 2008
  • DotNetNuke - Data Access Layer Alternative - August 12th, 2008
  • DotNetNuke - Modules - Linking within the module - August 14th, 2008
  • DotNetNuke - Make Your Module Searchable - August 19th, 2008
  • DotNetNuke Modules - Making Content Portable - August 25th, 2008
  • DotNetNuke Modules - Exceptions the DNN Way - September 2nd, 2008
  • DotNetNuke Modules - PortalModuleBase - September 4th, 2008
  • DotNetNuke Modules - Inter Module Communication - September 9th, 2008
  • DotNetNuke Modules - Finding The Page a Module is On - September 15th, 2008
  • DotNetNuke Modules - Caching - September 17th, 2008
  • DotNetNuke Modules - Module Settings - September 22nd, 2008
  • DotNetNuke Modules - Retrieving Settings - September 24th, 2008
  • DotNetNuke Modules - Advanced Architecture - October 20th, 2008
  • DotNetNuke Modules - Creating the PA - October 30th, 2008
  • DotNetNuke Modules - Automating the PA - November 5th, 2008
  • DotNetNuke - FileUploadControl Danger! - February 26th, 2009

If you're new here, you may want to subscribe to my RSS feed. Thanks for visiting!

Related Post

  • DotNetNuke Modules – Caching
  • DotNetNuke Modules – Exceptions the DNN Way
  • DotNetNuke Modules – Making Content Portable
Bookmark to:

Add to Del.icio.us Add to digg Add to DotNetKicks Add to DZone Add to Facebook Add to Slashdot Add to Stumble Upon Add to Technorati
Hide Sites
Tags: asp.net, cross page, csharp, dotnetnuke, modules

5 Responses to “ DotNetNuke Modules – Finding The Page a Module is On ”

  1. # 1 Néstor Sánchez Says:
    September 16th, 2008 at 11:29 am

    The tab iteration on a portal with thousands of pages will be quite expensive. A better solution from an architectural point is that the Checkout module saves its location to the DB, either by way of a module setting or a specific field in a module configuration table. In that manner, your other modules can retrieve this directly.

  2. # 2 Dave Says:
    September 16th, 2008 at 11:38 am

    Yes, it is (was).

    As is common with most of my post I only gave you the specifics on how to retrieve the information. I did not tell you what to do with it.

    IF you need to find out where a module is, this is how you do it. And even if you use this method, you wouldn’t retrieve it every time you hit the page because even on a relatively small site, you’d get killed on performance.

  3. # 3 Ant Says:
    September 16th, 2008 at 6:37 pm

    Will it be better if we do this?

    Dim objModuleController As DotNetNuke.Entities.Modules.ModuleController = New ModuleController()
    Dim moduleList As ArrayList = objModuleController.GetModulesByDefinition(PortalId, moduleName)
    For Each modInfo As ModuleInfo In moduleList
    ‘Return modInfo.TabID
    Next

  4. # 4 Ant Says:
    September 16th, 2008 at 6:38 pm

    Private Function GetFirstModuleTabId(ByVal PortalId As Integer, ByVal moduleName As String) As Integer
    Dim objModuleController As DotNetNuke.Entities.Modules.ModuleController = New ModuleController()
    Dim moduleList As ArrayList = objModuleController.GetModulesByDefinition(PortalId, moduleName)

    For Each modInfo As ModuleInfo In moduleList
    Return modInfo.TabID
    Next
    Return 0
    End Function

  5. # 5 Dave Says:
    September 16th, 2008 at 7:16 pm

    Without running I’d have to say no only because it looks like really old syntax if it worked at all.

← UML needs fixing claims founder
SQL For Programmers – Stored Procedure Basics →
  • Search

  • Subscribe

    U COMMENT
    I FOLLOW

    Subscribe in a reader

    OR

    Subscribe via e-mail

    Enter your email address: 

    Delivered by FeedBurner

     

  • Follow Me

    • Twitter
    • FaceBook
    • Digg
    • StumbleUpon
    • Propeller
    • Delicious
    • Plaxo

     

  • Recent Posts

    • ASUS Eee PC 1005HA-PU1X-BK Black Netbook
    • jQuery – Date Picker
    • Using VB.NET From CSharp
    • iTextSharp – Adding Images
    • Hungarian Notation – Use What Works, Spit Out The Bones
    • Pre Order Windows 7
    • jQuery Dialog – With Validation Controls
    • iTextSharp – The easy way
    • Structure of my ASP.NET Web Applications
    • 35% Off Accronis True Image 2009 Home
    • VB.NET Hide Module Name
    • ASP.NET/VB.NET – Video Training
    • Does jQuery Make Us Lazy?
    • PDFs Using iTextSharp
    • Programming SEO – Ping



  • Advertise on this site through Lake Quincy Media
  • DotNetNuke Sponsor

     

    Most Valuable Blogger
  • Sponsor

  • Categories

    • Advanced CSharp
    • Advanced VB.NET
    • ASP.NET MVC
    • Did you know
    • DotNetNuke – Module Development
    • DotNetNuke – Skinning
    • internationalization
    • iTextSharp
    • jQuery
    • none
    • Seach Engine Optimization
    • Silverlight
    • SQL For Programmers
    • Twitter
    • winforms
  • Cloud

    .net ajax architecture asp.net book books containers csharp css dal dataset datasets dotnetnuke events gridview images internationalization internet explorer javascript jQuery json linq listview modules ms-sql MVC objectdatasource programming reflection seo Silverlight skinning sql testing tsql tutorial Twitter twitterizer vb.net video view Vista visual studio webservice WordPress
  • Archives

    • July 2009
    • June 2009
    • May 2009
    • April 2009
    • March 2009
    • February 2009
    • January 2009
    • December 2008
    • November 2008
    • October 2008
    • September 2008
    • August 2008
    • July 2008
    • June 2008
    • May 2008
    • April 2008
    • March 2008
    • February 2008
    • January 2008
    • December 2007
    • November 2007
    • October 2007
  • Meta

    • Log in
    • Entries RSS
    • Comments RSS
    • WordPress.org
    • Privacy Policy
  • Calendar

    September 2008
    S M T W T F S
    « Aug   Oct »
     123456
    78910111213
    14151617181920
    21222324252627
    282930  
  • Blogroll

    • Alvin Ashcraft’s Morning Dew
    • ASP.NET Consulting
    • Life Hacker
    • Remember Anything
    • The Price of Their Toys
    • Uncategorized Thought


.NET Answers © 2007 - 2008 All Rights Reserved.
Entries and Comments.