The content you're reading is getting on in years
This post is on the older side and its content may be out of date.
Be sure to visit our blogs homepage for our latest news, updates and information.
>> albumCollection =
"album 1 for artist 1"
"album 2 for artist 1"
"album 3 for artist 1"
"album 1 for artist 2"
"album 2 for artist 2"
"album 3 for artist 2"
DynamicModuleManager dynamicModuleManager = DynamicModuleManager.GetManager();
Type albumsType = TypeResolutionService.ResolveType(
DynamicContent albumsItem = dynamicModuleManager.CreateDataItem(albumsType, itemId, dynamicModuleManager.Provider.ApplicationName);
// This is how values for the properties are set
Lstring(Regex.Replace(title, UrlNameCharsToReplace, UrlNameReplaceString)));
// We can now call the following to publish the item
ILifecycleDataItem publishedAlbumsItem = dynamicModuleManager.Lifecycle.Publish(albumsItem);
//You need to set appropriate workflow status
// You need to call SaveChanges() in order for the items to be actually persisted to data store
//Publish a new artists item
musicStyle, Guid albums)
Type artistsType = TypeResolutionService.ResolveType(
DynamicContent artistsItem = dynamicModuleManager.CreateDataItem(artistsType);
ILifecycleDataItem publishedArtistsItem = dynamicModuleManager.Lifecycle.Publish(artistsItem);
UrlNameCharsToReplace = @
As you can see two artists and six albums are created. Albums IDs are passed to the artists “Albums” fields so that the relations are set. Every artists has three albums. The next step will be to configure the widgets that are created with the custom content types. For this purpose we have added two new properties in the widgets. Place both content types widgets in a single page and in the albums widget advanced settings set RelatedDataTypeName to the content type name of the artist type (Telerik.Sitefinity.DynamicTypes.Model.RelatedDataTest.Artists). Set RelatedDataFieldName property in the same widget to the name the field of the related type where the id’s of the items are stored – in this case “Albums” field of the artist content type. Save and publish. When the page is viewed in the front end and an artist is selected the corresponding albums will be displayed.
With the latest version of Sitefinity Thunder comes a very nice option to create items selector for your related data in the backend which will ease the process. Have a look at the documentation article about configuring the new selector control.
Here you can find a video that goes through all of the configuration steps.
View all posts from The Progress Team on the Progress blog. Connect with us about all things application development and deployment, data integration and digital business.
Subscribe to get all the news, info and tutorials you need to build better business apps and sites
Copyright © 2019 Progress Software Corporation and/or its subsidiaries or affiliates.
All Rights Reserved.
Progress, Telerik, and certain product names used herein are trademarks or registered trademarks of Progress Software Corporation and/or one of its subsidiaries or affiliates in the U.S. and/or other countries. See Trademarks for appropriate markings.