Snippets
07

    using DotNetNuke.Abstractions;
    using DotNetNuke.Entities.Modules;
    using Microsoft.Extensions.DependencyInjection;

    public partial class MyModule : PortalModuleBase
    {
        private INavigationManager _navigationManager;

        protected override void OnInit(EventArgs e)
        {
            base.OnInit(e);
            _navigationManager = DependencyProvider.GetRequiredService<INavigationManager>();
        }

        // ... rest of your code
    }

 

  • Navigating to a module control within the current tab:

        string viewUrl = _navigationManager.NavigateURL(PortalSettings.ActiveTab.TabID, "View"); // "View" is the ControlKey
        Response.Redirect(viewUrl, true);

  • Navigating to a shared control (e.g., Login, Register):

        string loginUrl = _navigationManager.NavigateURL(PortalSettings.ActiveTab.TabID, "Login");
        Response.Redirect(loginUrl, true);

  • passing additional parameters.

You can pass extra parameters as a params string[] array or a NameValueCollection.

        string registerUrl = _navigationManager.NavigateURL(PortalSettings.ActiveTab.TabID, "Register", "param1=value1", "param2=value2");
        Response.Redirect(registerUrl, true);

  • Navigating to a specific tab/page.

        int targetTabId = 123; // Replace with the actual Tab ID
        string pageUrl = _navigationManager.NavigateURL(targetTabId);
        Response.Redirect(pageUrl, true);

Posted in: Custom Modules

Post Rating

Comments

There are currently no comments, be the first to post one!

Post Comment

Only registered users may post comments.

120 OLD FREEMANS WAY, BREWSTER, MA 02631
MAILING: P.O. BOX 2342, BREWSTER, MA 02631
PHONE (774) 323-3176