Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

In DotNetNuke, how can I get a ModuleInfo object if I just have a ModuleId (and not a TabId)

The only method provided by the DNN framework to get a module by ID also required a tab ID. What can I do if I don't have a tab ID?

like image 333
bdukes Avatar asked Oct 31 '25 02:10

bdukes


2 Answers

The GetModule method off of the DotNetNuke.Entities.Modules.ModuleController class will accept a "null" value for tab ID if you don't have a tab ID. That is, try the following:

new ModuleController().GetModule(moduleId, DotNetNuke.Common.Utilities.Null.NullInteger)

See also my blog post on the subject.

like image 142
bdukes Avatar answered Nov 02 '25 05:11

bdukes


One thing to watch out for when passing a null TabId to GetModule is that if you have a module that's installed on a number of different tabs, you'll be getting the first one back, so the values for TabId, TabModuleId and ModuleOrder will be based on that first instance, which may or may not be the instance you wanted.

HTH,

Don

like image 44
Don Worthley Avatar answered Nov 02 '25 05:11

Don Worthley



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!