Friday, April 10, 2009

Attachments field in DataView

Ran into this the other day, if you include the 'Attachments' field of a list in a dataview web part (i.e. DataFormWebPart Single Item View) you get text that says Yes or No depending on if this item has any attachments. Not exactly the behavior I was looking for; probably not the behavior ANYONE was looking for... If you want to show links to the actual attachment the same way as the normal DispForm ListView webpart shows them, remove the xslt for the attachments field and instead put:

<SharePoint:AttachmentsField ControlMode="Display" FieldName="Attachments" runat="server" Visible="true"/>


Just to be clear, I believe this will only work on a list form page. Why the @Attachment's field can't just at least output you the attachment names is beyond me...

1 comment:

Thomas King said...

Hi there,

Great tip and really appreciated! Save me a whole lot of pain :)

Regards
Thomas King