Products

Solutions

Resources

Partners

Community

Blog

About

QA

Ideas Test

New Community Website

Ordinarily, you'd be at the right spot, but we've recently launched a brand new community website... For the community, by the community.

Yay... Take Me to the Community!

Welcome to the DNN Community Forums, your preferred source of online community support for all things related to DNN.
In order to participate you must be a registered DNNizen

HomeHomeDevelopment and...Development and...Building ExtensionsBuilding ExtensionsModulesModulesWhy ActiveTab.ModuleID = -1 ?Why ActiveTab.ModuleID = -1 ?
Previous
 
Next
New Post
12/1/2014 7:31 AM
 

Hi guys very simple question that has me baffled for quite some time now.

Why is it that when I try to reference PortalSettings.Current.ActiveTab.ModuleID or PortalSettings.ActiveTab.ModuleID I get -1 as a result?

Is there something that I am just missing or not getting?

 

I've been working on DNN 7 (7.2.1 > 7.3.3) service routine. And I have access to module id on the client but when I make the call to do something on the server side I can't seem to get at correct module id.

Is it simply the case that beforeSend: that.services.setModuleHeaders is not attaching correct module id?

 

As a work around I employed this trickery to get at module id (Service Routine C#)

var moduleId = PortalSettings.Current.ActiveTab.ChildModules.Values.Where(m => m.ModuleName == "ModuleName").Single().ModuleID;

It works just fine but "ModuleName" is a hard coded string and thats not very cool.

My second option is to pass module id as extra parameter every time which is slightly better than first solution.

 

Anyone with ideas or suggestions as to why PortalSettings.Current.ActiveTab.ModuleID would return -1?

 
New Post
12/1/2014 8:31 AM
 
PortalSettings.Current.ActiveTab.ModuleID will only return a moduleID, if it has been passed in URL, e.g. while being in edit mode.
Otherwise, there might be multiple modules on the page.

Cheers from Germany,
Sebastian Leupold

dnnWerk - The DotNetNuke Experts   German Spoken DotNetNuke User Group

Speed up your DNN Websites with TurboDNN
 
New Post
12/1/2014 9:09 AM
 
Sebastian Leupold wrote:
PortalSettings.Current.ActiveTab.ModuleID will only return a moduleID, if it has been passed in URL, e.g. while being in edit mode.
Otherwise, there might be multiple modules on the page.

 

I see. That certainly helps to clear up that misunderstanding. Thanks Sebastian.

 
Previous
 
Next
HomeHomeDevelopment and...Development and...Building ExtensionsBuilding ExtensionsModulesModulesWhy ActiveTab.ModuleID = -1 ?Why ActiveTab.ModuleID = -1 ?


These Forums are dedicated to discussion of DNN Platform and Evoq Solutions.

For the benefit of the community and to protect the integrity of the ecosystem, please observe the following posting guidelines:

  1. No Advertising. This includes promotion of commercial and non-commercial products or services which are not directly related to DNN.
  2. No vendor trolling / poaching. If someone posts about a vendor issue, allow the vendor or other customers to respond. Any post that looks like trolling / poaching will be removed.
  3. Discussion or promotion of DNN Platform product releases under a different brand name are strictly prohibited.
  4. No Flaming or Trolling.
  5. No Profanity, Racism, or Prejudice.
  6. Site Moderators have the final word on approving / removing a thread or post or comment.
  7. English language posting only, please.
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out