SlickUpload
Welcome Guest Search | Active Topics | Log In | Register

Virtual path in the uploaded files repeater Options
sam
#1 Posted : Monday, March 31, 2008 2:29:59 PM
Rank: Newbie

Groups: Registered

Joined: 3/25/2008
Posts: 5

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 

ChrisHynes
#2 Posted : Monday, March 31, 2008 9:56:37 PM
Rank: Administration


Groups:

Joined: 7/7/2005
Posts: 1,586
Location: Scottsdale, AZ

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)) %>
Users browsing this topic
Guest
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.