Wednesday, June 4, 2008

How can we display attachments links of Custom List in dataview

I Created a custom list with attachment and displayed it in page using DataView but I didn't find any field of custom list to use it. Only I find 3 attributes
  1. Attachments: contains attachment folder
  2. FileRef: contains the document items FileRef column value
  3. FileDirRef: contains relative path folder
I find only way to list these attachments create a custom server control to display them and pass folder url to this control, we will generate this folder from previous attributes:

Add a custom server control like this in dataview xslt :
<spcontrol:attachment runat="server" id="attachmentLsts" path="/{@FileDirRef}/Attachments/{@Attachments}" />

this control will read path of attachment and will display list of attachment links.

No comments: