Small width layout Medium width layout Maximum width layout Small text Medium text Large text
     Search
Downloads Downloads Directory Directory Forums Forums Forge Forge Blogs Blogs        Marketplace Marketplace Careers Program Careers
Community › Forums Register  |  

AspDotNetStoreFront
  Ads  
Engage Software - Training Partner for DotNetNuke
 


  Sponsors  

Meet Our Sponsors

WebSecureStores -- ASP.NET & DotNetNuke Hosting Solutions
FCKeditor Project
Salaro -- Skins and more
OnyakTech
The best choice for your web site host, email hosting, and domain registration.
CrystalTech Web Hosting™
 


DotNetNuke Forums
 
  Forum  General DotNetN...  Extend It! ( Pr...  Running code when a module is added to container
Previous Previous
 
Next Next
New Post 9/16/2008 12:22 PM
User is offline Bill Caterino
10 posts
10th Ranked


Running code when a module is added to container 

I would like to run some code that looks to see if a custom user profile exists and if not, creates it.  I have the code to do this, however, I want to run this code every time the module is added to a container.  This way, it will only add the user profile to the current portal id. 

Is there an event I can trap that fires when a module is added to a container?  Thanks!

 
New Post 9/17/2008 12:35 AM
User is offline armand datema
185 posts
9th Ranked


Re: Running code when a module is added to container 

MM i wouldnt know about that but here is somethign i have done in the past.

Make a skinobject and add that in your container, when the container is added to your module that skinobject is run and you can do all your code in there. Just make sure you dont run it every time the container is loaded but check if the user is allready in the profile dont do aything alse run the code

 

 


Armand Datema
Complex css/xhtml and unobtrosive javascript skin conversion to make you stand out from the crowd

Latest work itbuzz & nu.nl/Z

SchwingSoft

 
New Post 9/17/2008 6:48 AM
User is offline William Severance
825 posts
www.wesnetdesigns.com
7th Ranked






Re: Running code when a module is added to container 

I assume that when you say "run code everytime the module is added to a container", you mean when the module is added to a page by using the "Add New Module" commands in the control panel.

If so, the best way to check if this is a new instance of the module is to check (usually in the Page_Load handler of the view control) with the following code:

If Me.Settings.Count = 0 Then
  'Run code to check if profile exists and create if necessary
  'Pre-configure module settings with at least one setting so that this code will not run next time.
End If

In the unlikely case that your module will not be adding at least one setting key/value to the ModuleSettings table, you will need to set one as follows:

Dim mc As New Entities.Modules.ModuleController()
mc.UpdateModuleSetting(Me.ModuleId, "Initialized", "True")

I generally create a class for the module's configuration, returning each setting as a strongly typed property and providing for loading and saving the configuration from/to ModuleSettings or TabModuleSettings as appropriate. In most cases, I include code such as the above to determine if the module has been initialized to both pre-configure the settings to default values and to run once any custom code.

 


Bill, WESNet Designs
 
New Post 9/17/2008 8:07 PM
User is offline Bill Caterino
10 posts
10th Ranked


Re: Running code when a module is added to container 

Nice!  A clever solution I never would have thought of.  Thanks!

 
Previous Previous
 
Next Next
  Forum  General DotNetN...  Extend It! ( Pr...  Running code when a module is added to container
 


Forum Policy

These Discussion Forums are dedicated to the discussion of the DotNetNuke Web Application Framework.

For the benefit of the community and to protect the integrity of the project, 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 DotNetNuke.
2. Discussion or promotion of DotNetNuke product releases under a different brand name are strictly prohibited.
3. No Flaming or Trolling.
4. No Profanity, Racism, or Prejudice.
5. Site Moderators have the final word on approving/removing a thread or post or comment.
6. English language posting only, please.

 


Mad Development: dotnetnuke design and development
We are an expert Dotnetnuke shop specializing in developing solutions that merge the requirements of design and branding, content management, ecommerce, search engine optimization and business logic.
www.MadDevelopment.com
telerik
telerik r.a.d.controls suite is the most innovative and comprehensive toolset for ASP.NET development, tailored for seamless integration with the DotNetNuke project. This integrated collection of controls allows professionals to build web-solutions with the UI richness and responsiveness of desktop applications.
dnn.telerik.com
CrystalTech
CrystalTech Web Hosting™ provides first-class service and support. Our value-packed ASP.NET plans offer DNN installation, SQL 2005 and up to 100 domain names starting at only $16.95 per month!
CrystalTech.com

DotNetNuke Corporation   Terms Of Use  Privacy Statement
DotNetNuke®, DNN®, and the DotNetNuke logo are trademarks of DotNetNuke Corporation
Hosted by MaximumASP