3
votes

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

1

1 Answers

3
votes

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.