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

HomeHomeArchived Discus...Archived Discus...Developing Under Previous Versions of .NETDeveloping Under Previous Versions of .NETASP.Net 2.0ASP.Net 2.0How to call a method when the module is createdHow to call a method when the module is created
Previous
 
Next
New Post
10/10/2007 5:12 AM
 

Hello everybody,

I'm creating a module using C#. I have a table MyModule_Category which has three columns: ItemId, ModuleId and Category. The items of this table will fill a dropdownlist on the first access to page. I need to insert some items in this table when the module is created (then the users which have edit permissions can delete the items they won't or add other items). I'm thinking to create a stored procedured (to which I pass the ModuleId) which does it. This stored procedure is called by a method. The question is: when have I to call the method? I need to call it only when the module is created. How can I do this? 

I really need your help, please reply!

 
New Post
10/10/2007 5:38 AM
 

Clarification: when I say "when the module is created" I mean "when the module is added to the page".

 
New Post
10/10/2007 5:55 AM
 

I would probably check if a modulesetting exists or not.

If the modulesetting doesn't exist create the items and then create the modulesetting.

So it will only run once.

 

 
New Post
10/10/2007 8:40 AM
 

Hello dawoe, thank you for your response.

Could you please be more specific? Please be patient, I'm new to dotnetnuke...

 
New Post
10/10/2007 9:49 AM
 

Hi deven83,

Here a small example that you can include in your page_load of your module

If not Settings.Contains("yourkey") Then

// do your stuff here

Dim objModuleController as New DotNetNuke.Entitities.Modules.ModuleController
objModuleController.UpdateModuleSetting(Me.ModuleID,"yourkey","any data you want")

 

End if

The second time the module loads the setting will be created and the code in the if-statement will not be executed

More on modulesettings here : www.adefwebserver.com/DotNetNukeHELP/Personalization/

 

 

 
Previous
 
Next
HomeHomeArchived Discus...Archived Discus...Developing Under Previous Versions of .NETDeveloping Under Previous Versions of .NETASP.Net 2.0ASP.Net 2.0How to call a method when the module is createdHow to call a method when the module is created


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