Register data as default when install a custom module
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.
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...
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)
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