DNN Forums

Ask questions about your website to get help learning DNN and help resolve issues.

Same module in same tabID

 4 Replies
 2 Subscribed to this topic
 30 Subscribed to this forum
Sort:
Author
Messages
New Around Here
Posts: 12
New Around Here

I built a module consisting of two controls: "view" and "settings".
The "setting" control acts on the database table associating "tabID", "ModuleID" and a parameter to be used in the "view" control.
When I insert the same module in the same page using (in the module settings) two different parameters it happens that the first module is displayed correctly while the second is not displayed... In the database table however everything is written correctly: two different records with the same TabID and different ModuleID and Parameter.
Any idea why this happens?

New Around Here
Posts: 12
New Around Here
...I found out the reason! The control contains a Google Chart made with Javascript code. The chart is displayed in a
element called "chart_div". Of course when I insert the module twice in the same page the element is written in the page with the same "ID" value and this creates confusion....
But in the same module there is also a TextBox control that in the code has an ID = "TextBox1" while in the source it is transformed into name="dnn$ctr392$view$TextBox1"... Will it be possible to do the same thing with "chart_div"?
New Around Here
Posts: 12
New Around Here
Of course 392 is the value of the ModuleID
Advanced Member
Posts: 208
Advanced Member
Helpful Replier
Helpful Replier
Thanks for being such a helpful replier!
MVP
MVP
You're an MVP!
New Poster
New Poster
Congrats on posting!
Difficult to say without seeing the code, but in these situations I usually add the ModuleId to the element id in the page, so you get an id of "chart_div392". And then I add that to all the JS, so there is always separation between the modules. NOTE: I have not done ascx for years, I usually use razor, so I am unsure of the exact code you need.
Senior Member
Posts: 1608
Senior Member
MVP
MVP
You're an MVP!
New Poster
New Poster
Congrats on posting!

This may be due to there being two different ID values for you to use and benefit from as a developer.

  • ModuleID:  Whenever a module is installed and used in DNN, all instances will have and use the same <code>ModuleID</code>.  If you have more than one instance on the same or other pages, they'll all share this value.  Keep this in mind before using it.  If you need to perform anything unique to a single instance of a module, this is NOT the property to use.  You should only use this property to manage things that will affect all instances of the module throughout the site.  
  • TabModuleID:  This value is unique to each instance of the value.  Regardless of how many times you put this module on a single page or throughout the site, each instance will have and use a specific ID for that instance of the module.  

I think you may want to consider using <code>TabModuleID</code>, instead of <code>ModuleID</code>.  

These Forums are for the discussion of the open source CMS DNN platform and ecosystem.

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

  1. If you have (suspected) security issues, please DO NOT post them in the forums but instead follow the official DNN security policy
  2. No Advertising. This includes the promotion of commercial and non-commercial products or services which are not directly related to DNN.
  3. 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.
  4. Discussion or promotion of DNN Platform product releases under a different brand name are strictly prohibited.
  5. No Flaming or Trolling.
  6. No Profanity, Racism, or Prejudice.
  7. Site Moderators have the final word on approving / removing a thread or post or comment.
  8. English language posting only, please.

Would you like to help us?

Awesome! Simply post in the forums using the link below and we'll get you started.

Get Involved