Skip to main content

DotNetNuke.Common.Globals.NavigateURL() Inside DotNetNuke Scheduler

I need to call this very usefull function of DNN from my Scheduler Class but I always get the following error.

Object reference not set to an instance of an object., stack at DotNetNuke.Common.Globals.NavigateURL(Int32 TabID, Boolean IsSuperTab, PortalSettings settings, String ControlKey, String Language, String[] AdditionalParameters) at DotNetNuke.Common.Globals.NavigateURL(Int32 TabID, Boolean IsSuperTab, PortalSettings settings, String ControlKey, String[] AdditionalParameters) at DotNetNuke.Common.Globals.NavigateURL(Int32 TabID, PortalSettings settings, String ControlKey, String[].....

For now I have no idea whats happening, I have already post an entry in this very old thread in DotNetNuke Forum and hopefully somebody can share there solution.

I will keep digging on this one, Once I have a solution I will add a comment on this post.

a s t a l a v i s t a

Comments

  1. Upon viewing the source code for NavigateURL function I notice that it gets the PortalSettings using PortalController.GetCurrentPortalSettings function which gets its data from HttpContext.Current.Items("PortalSettings") which we dont have if we are inside a Scheduled Task.

    So the solution is to include your portalsettings when calling the function. see below:

    This will return an error:
    DotNetNuke.Common.Globals.NavigateURL(_lastTabId, "", "view=detail", "messageid=" & messageId.ToString)

    This one will work
    DotNetNuke.Common.Globals.NavigateURL(_lastTabId, _portalSettings, "", "view=detail", "messageid=" & messageId.ToString)

    Now its up to you how you get your portalsettings.

    ReplyDelete
  2. Thanks

    To get your portalsettings use this:
    new DotNetNuke.Entities.Portals.PortalSettings(portalID)

    ReplyDelete

Post a Comment

Popular posts from this blog

Simple Color Picker - a jQuery color picker control

It's been a while since I build this small plugin for jQuery, While browsing through my files I try to see if this plugin still works with the latest version of jQuery which is 1.3.2 and it did. I have updated the sample and change the file names so it is easy to recognize. I also move the downloads to my google site, Download here . Focus on the input box below or click on the box next to the control to show color picker. Basic Sample jQuery(function($) { $("#vtrColorPicker").attachColorPicker(); }); Change Background jQuery(function($) { $("#vtrColorPicker1").attachColorPicker(); $("#vtrColorPicker1").change(function() { $("#content-wrapper").css("background-color",$("#vtrColorPicker1").getValue()); });

dnnAlert and dnnConfirm jQuery Plugin

I like the idea of using jQuery Plugins in DNN for interactive and consistent user interface which is why I digg into using dnnAlert and dnnConfirm plugins, however after a quick look on the documentation I notice the following. For dnnAlert you can't set the title. We are allowed to set the OK button text using okText option but not the dialog title? For dnnConfirm. This is very usefull when you just want a confirmation dialog upon click on your button or link however you can't use it like javascript confirm function or at least I don't know how to use it like below: if(confirm('Question?')){//some code}

A javascript library for formatting and manipulating numbers.

Numeral.js , while less complex, was inspired by and heavily borrowed from  Moment.js  so if you have use momentjs before you should be familiar with this library. Numbers can be formatted to look like currency, percentages and more. How to use: numeral(1000).format('0,0') returns 1,000 numeral(1230974).format('0.0a') returns 1.2m numeral(1000.234).format('$0,0.00') returns $1,000.23 numeral(1230974).format('($ 0.00 a)') returns $ 1.23 m numeral(1).format('0%') returns 100% numeral(0.974878234).format('0.000%') returns 97.488% For more sample and options go to  http://numeraljs.com/ .