Products

Solutions

Resources

Partners

Community

Blog

About

QA

Ideas Test

New Community Website

Ordinarily, you'd be at the right spot, but we've recently launched a brand new community website... For the community, by the community.

Yay... Take Me to the Community!

Welcome to the DNN Community Forums, your preferred source of online community support for all things related to DNN.
In order to participate you must be a registered DNNizen

HomeHomeDevelopment and...Development and...DNN Platform (o...DNN Platform (o...Delete module instance from pageDelete module instance from page
Previous
 
Next
New Post
12/21/2009 3:53 PM
 

Hi,

I developed a dnn photo viewer which shows photos on my DNN page. Photos can be uploaded and will eventually be stored in the database. Within the module I can delete photos. My problems occurs when I delete the module instance from my page. I would like to clean up the database by deleting the photos used for this instance. Is there an event which throws on deleting an module from the page?

Can anyone help me out?

Chris Lewis

 
New Post
12/21/2009 4:19 PM
 

Chris,

I think your best bet would be to add a button and event to your Settings.ascx file. (assuming you have one) And adding code that deletes the desired photos / db entries.

So, you have a 2 step process:

1.  Delete files through settings

2. Delete module as normal

Or if you already have an admin control to upload images then just add the ability to delete (or delete all)

Trying to tie into the module delete event just doesn't seem worth the effort.

 

Robert

 

 
New Post
12/25/2009 8:15 AM
 

Hi Robert,

Thanks for your reply. I understand that there is no such thing as an override delete event. Strange. This polutes the DNN database in no time. I also set a SQL trace to the HTML module of DNN and concluded that even a core module doesn't clean up it's data after deleting the module instance. Perhaps a good idea for a future version of DNN..

Anyway, thanks for your effort.

Chris

 
New Post
12/25/2009 9:12 PM
 

Most modules create a foreign key constraint on the ModuleId column of their primary data table back to the DNN Modules table with cascade delete enabled so that when the module instance is finally deleted, data used by the module will be deleted from the database. Is this a best practice? Probabably not as the addition of the FK constraint effectively alters a core DNN database table which could cause problems should a framework upgrade need to drop or significantly alter the Modules table. Since the Modules table will most likely always include a ModuleId column of type int as its primary key, I still feel comfortable in following this approach - until the core exposes a module delete event or other API based approach, which I agree we developers need. Without such an event/api based approach there is no good way currently for the module to delete non-database stored files associated with the module instance from the physical file system.

Take particular note of the above phrase "when the module instance is finally deleted . . ." Remember that when a module is deleted it is placed in the module recycle bin (by setting the IsDeleted field in the Modules table) until the recycle bin is emptied of all or that particular module reference. At that point and not before, the deletion of the module instance from the Module (and other core tables) will occur, triggering the cascade delete and removal of data associated with that module instance from the module's custom tables.


Bill, WESNet Designs
Team Lead - DotNetNuke Gallery Module Project (Not Actively Being Developed)
Extensions Forge Projects . . .
Current: UserExport, ContentDeJour, ePrayer, DNN NewsTicker, By Invitation
Coming Soon: FRBO-For Rent By Owner
 
Previous
 
Next
HomeHomeDevelopment and...Development and...DNN Platform (o...DNN Platform (o...Delete module instance from pageDelete module instance from page


These Forums are dedicated to discussion of DNN Platform and Evoq Solutions.

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

  1. No Advertising. This includes promotion of commercial and non-commercial products or services which are not directly related to DNN.
  2. 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.
  3. Discussion or promotion of DNN Platform product releases under a different brand name are strictly prohibited.
  4. No Flaming or Trolling.
  5. No Profanity, Racism, or Prejudice.
  6. Site Moderators have the final word on approving / removing a thread or post or comment.
  7. English language posting only, please.
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out