Posted By Dave ShiftUP on 7/26/2020 4:42 PM
Here is a full synopsis of how to move from the old NavigateURL to the new method
References for your project must be made to:
- DotNetNuke.Abstractions
- Microsoft.Extensions.DependencyInjection
- Microsoft.Extensions.DependencyInjection.Abstractions
- * the dlls can be found in the bin directory
- DotNetNuke.Abstractions is required for INavigationManager and must be declared above as an imports or using (depending on language) before your class definition
- Microsoft.Extensions.DependencyInjection is required as an imports/using so that you can call on the PortalModuleBase.DependencyProvider
Each of these returns a string which you can then do redirects with or whatever.
- The old way - Common.Globals.NavigateURL(PortalSettings.ActiveTab.TabID, "YourControlKey", "mid=" & CStr(ModuleId))
- The new way - DependencyProvider.GetRequiredService(Of INavigationManager).NavigateURL(PortalSettings.ActiveTab.TabID, "YourControlKey", "mid=" & CStr(ModuleId))
If you want to circumvent the call to DotNetNuke.Abstractions you can call it like this:
DependencyProvider.GetRequiredService(Of Abstractions.INavigationManager).NavigateURL(PortalSettings.ActiveTab.TabID, "YourControlKey", "mid=" & CStr(ModuleId))
Nice... This would make for a great blog post! If you're interested, I'd be happy to open up blogging to you so you can blog about this here. :)