DNN: Navigate from Module in a Tab to a Module in different Tab

        /// 
        /// Gets the user management URL.
        /// 
        /// The portal id.
        /// 
        protected string GetUserManagementUrl(int portalId)
        {
            int userManagementTabId = GetTabIdForCurrentPortal(AppConfiguration.UserManagementTabName);
            int moduleId = GetModuleId(userManagementTabId, AppConfiguration.UserManagementModuleName);
 
            string[] param = new string[4];
            param[0] = Constants.MODULE_ID_NAME;
            param[1] = moduleId.ToString();
            param[2] = Constants.PORTAL_ID_PARAMETER;
            param[3] = portalId.ToString();
 
            DotNetNuke.Common.Globals.ApplicationURL();
 
            return DotNetNuke.Common.Globals.NavigateURL(userManagementTabId, AppConfiguration.UserManagementControlName, param);
        }

        /// 
        /// Gets the tab id for current portal.
        /// 
        /// Name of the tab.
        /// 
        protected virtual int GetTabIdForCurrentPortal(string tabName)
        {
            TabController tabController = new TabController();
            TabInfo tabInfo = tabController.GetTabByName(tabName, PortalId);
            return tabInfo.TabID;
        }
 
        /// 
        /// Gets the tab id for portal.
        /// 
        /// Name of the tab.
        /// The portal id.
        /// 
        protected virtual int GetTabIdForPortal(string tabName, int portalId)
        {
            TabController tabController = new TabController();
            TabInfo tabInfo = tabController.GetTabByName(tabName, portalId);
            return tabInfo.TabID;
        }
 
        /// 
        /// Gets the module id.
        /// 
        /// The tab id.
        /// Name of the module.
        /// 
        protected virtual int GetModuleId(int tabId, string moduleName)
        {
            ModuleController moduleController = new ModuleController();
            Dictionary<int, ModuleInfo> genericModuleInfos = moduleController.GetTabModules(tabId);
            ModuleInfo selectedModule = null;
 
            foreach (KeyValuePair<int, ModuleInfo> pair in genericModuleInfos)
            {
                if (pair.Value.ModuleName.Equals(moduleName, StringComparison.InvariantCultureIgnoreCase))
                    selectedModule = pair.Value;
            }
 
            if (selectedModule != null)
                return selectedModule.ModuleID;
            return -1;
        }
 
        /// 
        /// Gets the user count for the passed in portal id.
        /// 
        /// The portal id.
        /// 
        protected virtual int GetPortalUserCount(int portalId)
        {
            MembershipProvider membershipProvider = MembershipProvider.Instance();
            return membershipProvider.GetUserCountByPortal(portalId);
        }

Published by

Tim Clark

Experienced Business Owner, Chief Information Officer, Vice President, Chief Software Architect, Application Architect, Project Manager, Software Developer, Senior Web Developer, Graphic Designer & 3D Modeler, University Instructor, University Program Chair, Academic Director. Specialties: Ruby, Ruby on Rails, JavaScript, JQuery, AJAX, Node.js, React.js, Angular.js, MySQL, PostgreSQL, MongoDB, SQL Server, Responsive Design, HTML5, XHTML, CSS3, C#, ASP.net, Project Management, System Design/Architecture, Web Design, Web Development, Adobe CS6 (Photoshop, Illustrator)

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s