Assisted Solutions Forums

Welcome! These forums provide help and documentation for our products and services.
Welcome to Assisted Solutions Forums Sign in | Join | Help
in Search

Virtual path in the uploaded files repeater

Last post 03-31-2008, 9:56 PM by ChrisHynes. 1 replies.
Sort Posts: Previous Next
  •  03-31-2008, 2:29 PM 4018

    Virtual path in the uploaded files repeater

    I would like to display a hyperlink to uploaded files in my uploaded files repeater. I'm currently throwing up a link to the physical path with this:

    <td><asp:HyperLink ID="HyperLink1" runat="server" NavigateUrl="<%#DirectCast(Container.DataItem, UploadedFile).LocationInfo(FileUploadStreamProvider.FileNameKey)%>"><%#DirectCast(Container.DataItem, UploadedFile).ClientName%></asp:HyperLink></td>

    Can anyone tell me the easiest way to do this?  I've tried wrapping this code up in some string functions to replace the plysical with the virtual but have had no joy...

    Oh and if it matters I'm using PrefixFolderFileNameGenerator..

    Any help much appreciated

    Thanks 

  •  03-31-2008, 9:56 PM 4019 in reply to 4018

    Re: Virtual path in the uploaded files repeater

    Assuming you're storing the files inside your application path, you should be able to chop off the leading path and then use ResolveUrl to ensure its the correct virtual path. Something like this should work:

    <%# ResolveUrl("~/" + DirectCast(Container.DataItem, UploadedFile).LocationInfo(FileUploadStreamProvider.FileNameKey).Substring(MapPath("~/").Length)) %>
View as RSS news feed in XML
Powered by Community Server, by Telligent Systems