Href and <%# DataBinder.Eval(Container.DataItem, "Name") %> ?

Discussion in 'ASP .Net' started by Lauchlan M, Oct 15, 2003.

  1. Lauchlan M

    Lauchlan M Guest

    Hi

    In my aspx page HTML I have

    <a href='<%# DataBinder.Eval(Container.DataItem, "Name") %>'> <%#
    DataBinder.Eval(Container.DataItem, "Name") %>

    I am trying to create a hyperlink to
    applicationroot\FileUploads\Filename.FileExtension.

    At the moment it instead generates

    http://localhost/MyWebApplication/TheFolderTheaspxPageIsIn/FileName.FileExtension .

    If I try

    <a href="~/FileUploads/"'<%# DataBinder.Eval(Container.DataItem, "Name")
    %>'> <%# DataBinder.Eval(Container.DataItem, "Name") %>

    it generates

    http://localhost/MyWebApplication/TheFolderTheaspxPageIsIn/~/FileUploads/FileName.FileExtension

    whereas I want

    http://localhost/MyWebApplication/FileUploads/FileName.FileExtension

    Any suggestions?

    Thanks!

    Lauchlan M
     
    Lauchlan M, Oct 15, 2003
    #1
    1. Advertising

  2. Lauchlan M

    Lauchlan M Guest

    Figured it out.

    <a href='<%# Server.MapPath("~/FileUploads/")%>
    <%# DataBinder.Eval(Container.DataItem, "Name") %>'>
    <%# DataBinder.Eval(Container.DataItem, "Name") %>
    </a>

    For anyone who'se interested.

    Lauchlan M
     
    Lauchlan M, Oct 15, 2003
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Tom Lee
    Replies:
    2
    Views:
    854
    Chris Carter
    Dec 9, 2003
  2. bg
    Replies:
    5
    Views:
    6,514
    Scott Allen
    Apr 16, 2004
  3. Ken Cox [Microsoft MVP]
    Replies:
    1
    Views:
    3,509
    Charlie@CBFC
    May 12, 2004
  4. Eric Newton
    Replies:
    3
    Views:
    9,557
    Brock Allen
    Apr 4, 2005
  5. Joe Rattz
    Replies:
    2
    Views:
    629
    Robert Koritnik
    Sep 10, 2004
Loading...

Share This Page