I have build a module in DotNetNuke 6 that contains multiple module definitions. A module can be added on multiple pages (tabs) and multiple module can be added to one page (tab).
Problem is that I can’t find an identifier that ties all my module definitions together from one instance.
DesktopModuleId is only unique for every module installed (not per instance and page).
ModuleId is unique for every module instance and definition.
TabModuleId is unique for every module instance and tab and definition.
So what I’m looking for is a way to identify which module definitions belong to each other the moment I put a module on the page.
I found a forum post which explains the same problem and someone suggested to look at the ModuleId for every definition and check if they are sequential. I find that very hackies.
Edit:
The module I’m developing contains a number of different definitions, but let’s say we have 3 (view, edit and settings). When I install the module I have to set a category I’m gonna use for the module, say I want it to be a blog module. All 3 definitions will then get data from the database with their same unique id (supposedly). Now I install again the same module, I want to choose another category (portfolio) and only get that data. The way DNN works now, I can’t separate my blog items from my portfolio items as there’s no way to know that my 3 blog definitions belong to each other and are separate of the other 3 portfolio definitions. I hope this make sense…
I solved my own question with the code below. It’s not the preferred solution, but I had success using it and it will do until DNN implements a real solution.
All methods from the
Controllerclass connect a custom table in the database. The code checks for all module definitions if they are on the current page (tab) and not already in the db. If not it will add it to the db combined with a new instance id. If 2 or more of the same modules are added to the page and this code runs later (e.g. update), it will only get the module ids that are sequential (the other module ids will be added later).Hopefully someone will find this useful or DNN will add it in the source 🙂