14 Apr 2009 @ 5:48 PM 
 

Showing Attachments in a Custom aspx page in SharePoint

 

This post applies to Microsoft Office SharePoint Server 2007 and WSS 3.0

Scenario: You have built a Custom .aspx page using SharePoint Designer that is stored in a Document Library. You have added the Default Master page to the Custom page so that your css is consistent with the rest of the SharePoint pages on your site. You have added a data source that is a SharePoint list that will be displayed on the page as a single item data view. When viewing the Custom .aspx page you are unable to view the links that would be included as the attachments. The attachment links are normally viewable on a standard DispForm.aspx that is generated by a list, but not in this case. HOW DO YOU DISPLAY THE ATTACHMENT LINKS?

Solution: I’ve done a lot of searching blogs and documentation on this problem. I’ve given up on it several times. However, after finding some hints and information on some blogs I’ve been using the following solution. You will have to open the Custom .aspx page in code view. When SharePoint Designer adds the “Single Item View” it generates an xsl tag coded as <xsl:template name=”dvt_1.rowview”>  . This can be found at the top of the view inserted. Once you locate this tag, immediately after it insert the following code:

<tr>
          <td width=”190px” valign=”top” class=”ms-formlabel”>
           <h3 class=”ms-standardheader” style=”width: 163px; height: 12px”>
            <nobr>Attachments</nobr>
           </h3>
          </td>
          </tr>
          <tr>
          <td width=”400px” valign=”top” class=”ms-formbody”>
           <SharePoint:AttachmentsField ControlMode=”Display” FieldName=”Attachments” runat=”server” Visible=”true”/>
          </td>
          </tr>

Save the file and reload it in your browser. You should now see the attachments link in your Single item view.

Tags Categories: SharePoint Posted By: Clinton Daniel
Last Edit: 14 Apr 2009 @ 05 52 PM

E-mailPermalink
 

Responses to this post » (2 Total)

 
  1. kadir said...
    10:08 pm - June 4th, 2009

    … but what about displaying a preview of the attachment? Any ideas would help

  2. admin said...
    9:52 am - June 7th, 2009

    I’ve occasionally run into this question. I can’t take credit for this solution, but the following blog written by Drasko Popovic in “CodeProject” is a solid solution. Give it a try:Click here for CodeProject solution

 

Leave A Comment ...

 

 XHTML:
You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>
\/ More Options ...
Change Theme...
  • Users » 2
  • Posts/Pages » 16
  • Comments » 41
Change Theme...
  • VoidVoid
  • LifeLife « Default
  • EarthEarth
  • WindWind
  • WaterWater
  • FireFire
  • LiteLight
  • No Child Pages.