Will "the Mighty" Strohl

HOW TO: Get Module By ModuleID (without the TabID) in DotNetNuke

A problem has existed in DotNetNuke® where it proved difficult to get an instance of a module without having both the ModuleID and TabID for the specific instance.  But what if you only have the ModuleID?  This use-case pops up all of the time.

I had come up with my own workaround for this at one point, and it wasn't pretty, but Brian Dukes from Engage Software checked the DNN source code and found out that while many of us had wrote our providers and workarounds, DotNetNuke® has long supported the return of a module using the ModuleID when you didn't know the TabID.

His blog post outlines that the GetModule(int ModuleID, int TabID) method accepts a null integer in place of the TabID.  Duh!  His suggestion was to pass in Null.NullInteger for the TabID.   Luckily, he also did the work for us to ask for an overload from the DNN Core Team.

Great job, Brian!  And thanks for sharing this with us!

blog comments powered by Disqus