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

Forums / Bugs & Issues / Media picker linking by Id not OriginalContentId??

Media picker linking by Id not OriginalContentId??

3 posts, 0 answered
  1. Steve
    Steve avatar
    3037 posts
    Registered:
    03 Dec 2008
    23 May 2013
    Link to this post
    I had the following code, but the results on the front end were not showing me anything

    protected void documentListView_NeedDataSource(object sender, RadListViewNeedDataSourceEventArgs e)
            {
                LibrariesManager manager = LibrariesManager.GetManager();
                List<Guid> documentIds = this.ContentLinks.Select(x => x.ChildItemId).ToList();
     
                var docs = (from d in manager.GetDocuments()
                           where documentIds.Contains(d.OriginalContentId)
                           select d);
                 
                ((RadListView)sender).DataSource = docs.OrderByDescending(x => x.LastModified);
            }

    When I modified it to this
    where documentIds.Contains(d.OriginalContentId) || documentIds.Contains(d.Id)

    ...stuff appears again

    This is the dynamic module builder document linker field type.  This concerns me because the Ids change when the doc changes right?
  2. Steve
    Steve avatar
    3037 posts
    Registered:
    03 Dec 2008
    24 May 2013
    Link to this post
    ...source shows this to be the case, am I offbase here?
  3. Boyko Nistorov
    Boyko Nistorov avatar
    16 posts
    Registered:
    17 Oct 2016
    28 May 2013
    Link to this post
    Hi Steve,

     Document.Id property is mapped to sf_media_content.content_id, which isn't changed in case of document modification.

    OriginalContentId field holds the linkage between document's lifecycle versions (Live, Temp objects linked to Master one). 

    So, if you modify the document in the backend, you'll not lose the linkage between the dynamic item and the document you eventually modified.

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