HOW TO: Get Module By ModuleID (without the TabID) in DotNetNuke
Oct
30
Written by:
10/30/2008
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!
2 comment(s) so far...
Re: HOW TO: Get Module By ModuleID (without the TabID) in DotNetNuke
i want to know how i get module id becuase i create new module but i cann't excute it becuase i want to pass module id ?
By almny on
5/10/2009
|
Re: HOW TO: Get Module By ModuleID (without the TabID) in DotNetNuke
The answer to your question depends on where you're needed to gather it from. If you're doing it from a Module, make sure your module is inheriting the PortalModuleBase classs, which will allow you to call it like so:
C#: this.ModuleID VB: Me.ModuleID
Otherwise, your answer can be much more complicated.
By Will on
5/10/2009
|