More in this section

Forums / Designing with Sitefinity / Show images for file types

Show images for file types

2 posts, 0 answered
  1. Drew Reutlinger
    Drew Reutlinger avatar
    17 posts
    25 Sep 2009
    30 Jun 2010
    Link to this post
    I want to show an icon for the type of a file that is linked in a generic content control. Is this a case of using a completely custom generic content control?
  2. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    12 Sep 2017
    30 Jun 2010
    Link to this post
    Hi Drew Reutlinger,

    Generic Content is RadEditor wrapper. Inside the Generic Content control you have just HTML. You can achieve your goal by creating a custom control that inherits from Generic Content and implement a custom designer for it. You will find a sample code here How to wrap a Generic Content control in 3.6 SP1
    Inside the designer there is a method - OnSaving() - called by the ControlEditor when the component is about to be saved. You need to override this method and you should not call the base. You have to get the content and check for dynamic links. Then resolve the link and get the content item. Afterwords you have to get the mime type of the item and alter the HTML by adding an image using RegularExpression.

    sample code

    public override void OnSaving()
           // this is the RadEditor content which contains all dynamic links.                            
           string conentText = this.Container.TextEditor.Text;

    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