SharePoint - Display attached files on SPGridView

Asked By Bookworm on 06-Jan-12 08:16 AM

i have selected some fields of my list, to bind in a grid view, every item has one attached file, and i want to display this attached file on the grid, because the user can only see the web part, so it can see only the SPGridView,.
i retrieve the data from the list in a DataTable and then bind it to the grid, but i dont know how can i retrieve the attached file.

Any idea?

Anoop S replied to Bookworm on 06-Jan-12 10:07 AM
Created an anchor type item template in grid view.

And the Href property of the anchor tab is binded with the attachment retrieved pro grammatically.
Bookworm replied to Anoop S on 06-Jan-12 10:22 AM
thnx but if you can
explain it better because i dont understand this way,

ok i will create a columns type HtmlAnchor, than?......

pls its very urgent to me
kalpana aparnathi replied to Bookworm on 06-Jan-12 02:47 PM

Take a look a the Attachments property of the SPListItem, it returns an SPAttachmentCollection, from there itterate the SPFiles and use the Url property to get the site relative path and you should be sorted from there.