简体   繁体   English

Sharepoint:带有链接的图像字段

[英]Sharepoint: Image field with a link

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. 您输入的两个字段将是要显示的图像的URL,以及超链接的URL。

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). 我注意到Type(在文档库中)列就是这样,并且还包括当前正在使用的视图(在文件夹的情况下)。

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)? 是否可以在文档库中复制计算出的Type字段以读取列表中的其他两个字段(它将充当图像URL和重定向链接)? What would the CAML be? CAML会是什么?

Thanks in advance if anyone could offer any insight. 如果有人能提供任何见解,请提前致谢

Arnhem 阿纳姆

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. 如您所见,SharePoint的图片默认渲染没有超链接。 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. 还有几个在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. MSDN文章提供了很多关于它如何工作的详细信息,但是不要让它让你失望,因为它不是太棘手。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM