Creating a site for a business unit and they wanted to display an attachments link for certain list items in a custom built DataFormWebPart. Seemed pretty straightforward to just add the attachment column to the DataFormWebPart, however when rendered it was a yes/no value, not very useful as we don’t care IF there is an attachment, we want the link to the attachment.
So instead of this column, we can crack open the XSL Editor and the following to our DataFormWebPart to display the attachment button:
<SharePoint:AttachmentButton ControlMode="Edit" Enabled="true" ItemId="{@ID}" runat="server" Visible="false"/> <SharePoint:AttachmentsField ControlMode="Display" ItemId="{@ID}" EnableViewState="true" FieldName="Attachments" runat="server"/>