More in this section

Forums / Developing with Sitefinity / How to display image Author?

How to display image Author?

2 posts, 0 answered
  1. Bruno Michels
    Bruno Michels avatar
    125 posts
    16 Apr 2010
    25 Jun 2010
    Link to this post
    I want to display the author of the image right bellow it, but only in the NewsView control.

    The image is from a library and it is in the content of a News...

    How can I do that?
  2. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    12 Sep 2017
    27 Jun 2010
    Link to this post
    Hi Bruno Michels,

    It depends on for which mode you want to this - when the control is in master mode - all items are listed or you have opened a single item.

    In both the cases the way that you have to do this is the same, but the difference is in the methods of NewsView control that you have to override.

    For master mode when all items are displayed in a list you have to override SetItemMetadata method. The method has two parameters - itemContainer and contentItem. You need to get the content from contentItem.Content property and then check each occurrence of [Libraries]Guid by using RegularExpression. Then get the image by the ID available in the dynamic url, and there you can call libraryItem.GetMetaData("Author").ToString(). Finally you need to change the contentItem.Content and add the image Author.

    For details mode you have to override SetSingleItemContent and follow the steps above.

    The better option is creating another metakey and use it to show the image - similar to Thumbnail. This will be the easiest way.

    Kind regards,
    Ivan Dimitrov
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
2 posts, 0 answered