Sharepoint: Image field with a link

14,522

This can be done but you would need to develop a custom field type. As you have found, SharePoint's default rendering for pictures is without the hyperlink. You need to change how the rendering behaves in Display mode in your own custom field. Check Patterns in Custom Field Rendering for more info.

There are also several examples of creating custom field types on the web. The MSDN articles give a lot of detail about how it all works but don't let that put you off as it's not too tricky.

Share:
14,522
Arnhem
Author by

Arnhem

Updated on June 04, 2022

Comments

  • Arnhem
    Arnhem almost 2 years

    I would like to add a field to a list with displays an Image, but acts as a hyperlink. In other words like the "Hyperlink or Picture" column, but "Hyperlink AND Picture" instead.

    Where the two fields you input would be the URL to the image to display, and the URL of the hyperlink.

    This must be possible. I notice that the Type (in a document library) column does just that, and also includes the views that are currently being used (in the case of a folder).

    Is it possible to duplicate the computed Type field in a document library to read two other fields in the list (which will act as the image url, and the redirect link)? What would the CAML be?

    Thanks in advance if anyone could offer any insight.

    Arnhem

  • Arnhem
    Arnhem almost 15 years
    Hi Alex, I exactly did not want to have to create a custom field type, since there are so many additional files then that have to be added. What I did instead was add a new field to the list schema.xml and then (copying the Type column) changed the display pattern. But I'm thinking of adding this display pattern into a custom field now that i understand the process a little better. I've edited my original post to include my new field.
  • Alex Angas
    Alex Angas almost 15 years
    That's a good idea too. You do get more power with a custom field but if editing the list schema.xml works fine it might be better to stick with that. Otherwise you'll have yet another SharePoint artifact to maintain! :)