+1-888-365-2779
Try Now
More in this section

Forums / General Discussions / Register data as default when install a custom module

Register data as default when install a custom module

4 posts, 0 answered
  1. Edwin
    Edwin avatar
    11 posts
    Registered:
    27 Oct 2015
    21 Apr
    Link to this post
    Hello, I need help, how i can add default data when a custom module is installed per first time, for example when the locations module is being installed i want also that register some locations.
  2. Pavel Benov
    Pavel Benov avatar
    21 posts
    Registered:
    29 Nov 2016
    28 Apr
    Link to this post
    Hello Edwin,

    What type of custom module are you installing? Is it a custom static module or dynamic module (via Module builder)?

    For static module you can use the Install method of the module's class. You can check the following sample of the ProductsModule in git hub:

    https://github.com/Sitefinity-SDK/Telerik.Sitefinity.Samples.Products/blob/master/Products/ProductsModule.cs

    For dynamic module you can use the EventHub and subscribe to the ... event:

    http://docs.sitefinity.com/event-system-eventhub

    protected void Application_Start(object sender, EventArgs e)
            {           
                Bootstrapper.Initialized += Bootstrapper_Initialized;
            }
     
            void Bootstrapper_Initialized(object sender, Telerik.Sitefinity.Data.ExecutedEventArgs e)
            {
                if (e.CommandName != "Bootstrapped")
                {         
                    EventHub.Subscribe<IDynamicModuleTypeCreatedEvent>(evt => DynamicModuleTypeCreatedEvent(evt));
                }
            }
     
            private void DynamicModuleTypeCreatedEvent(IDynamicModuleTypeCreatedEvent evt)
            {
                //logic...
            }


    Regards,
    Pavel Benov
    Telerik
     
    Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Sitefinity CMS Ideas&Feedback Portal and vote to affect the priority of the items
     
  3. Edwin
    Edwin avatar
    11 posts
    Registered:
    27 Oct 2015
    02 May in reply to Pavel Benov
    Link to this post

    Hello Pavel thanks for answer my question but i already do this also as you say in the install method of my custom static module.

    Now i have another problem, why can not delete the actions column for example if i don't add my custom data column "pathColumn" it not will be see in the items list, but with ActionsMenuColumn seems like it doesn't work.

    (Please see capture.png and ignore upload.png)

  4. Pavel Benov
    Pavel Benov avatar
    21 posts
    Registered:
    29 Nov 2016
    12 May
    Link to this post
    Hi Edwin,

    Can you comment out the entire logic for the Actions menu column, rebuild the solution and try again? Additionally please test this by first clearing your browser's cache (or inspecting this on another browser).

    Regards,
    Pavel Benov
    Telerik
     
    Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Sitefinity CMS Ideas&Feedback Portal and vote to affect the priority of the items
     
4 posts, 0 answered