Try Now
More in this section

Forums / Developing with Sitefinity / Filter Releated DynamicContent

Filter Releated DynamicContent

3 posts, 0 answered
  1. Henriette
    Henriette avatar
    41 posts
    20 Aug 2009
    03 Sep 2013
    Link to this post
    I'am stroggling with this Query that should list colors in a dropdownlist. The colors are selected on a product and are stored in a releated table. All seem to Work fine exept for the filtered Collection. Anyone have an iden??
    Many thanks in advance :-)))

    Public Function GetColorDataItems() As IQueryable(Of DynamicContent)
        ' Fetch a collection of "live" and "visible" color items that is selected / conained in the current Product
        Dim dynamicModuleManager As DynamicModuleManager = dynamicModuleManager.GetManager()
        'Get the Type for the Color
        Dim FarveType As Type = TypeResolutionService.ResolveType("Telerik.Sitefinity.DynamicTypes.Model.Produkter.Farve")
        'Set the product Guid
        Dim Productguid As Guid = New Guid(Me.hdnProductId.Value) '("2f0bcd28-a68f-6507-ad29-ff00003013e0")
        'Get the Product item as DynamicContent
        Dim produktItem As DynamicContent = RetrieveProduktByID(Productguid)
        'Get at list of Guid's that are selected on the product
        Dim assignedColors = produktItem.GetValue(Of TrackedList(Of Guid))("Farve")
        'Get a collection of all the colors based on each selected guid (assignedColors)
        Dim FilteredCollection = dynamicModuleManager.GetDataItems(FarveType).Where(Function(i) i.GetValue(Of TrackedList(Of Guid))("Farver").Contains(assignedColors))
        Return myFilteredCollection
    End Function
  2. Henriette
    Henriette avatar
    41 posts
    20 Aug 2009
    04 Sep 2013 in reply to Henriette
    Link to this post
    Hi Again
    I found a solution written by Vasilev in May 2013, where he actualy have written how to first get alle the itemsid guid from the current record and then filter releated content from other types. If anyone needs this is here: http://www.sitefinity.com/blogs/veselin-vasilev-blog/2013/05/29/working-with-related-dynamic-content-items-in-sitefinity

    Best regards
  3. Slavo
    Slavo avatar
    295 posts
    24 Sep 2012
    04 Sep 2013
    Link to this post
    Hello Henrik,

    I am glad you've found the solution described by Veselin. This is the recommended way to work with related items.

    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 Public Issue Tracking system and vote to affect the priority of the items
3 posts, 0 answered