How do I set a hyperlink to a subdirectory

  • Thread starter Eva White via .NET 247
  • Start date
E

Eva White via .NET 247

I am trying to set a field in a Datagrid to open a file locatedin the downloads/ directory on my website. The following codecreates hyperlinks in my datagrid, but when I click on thesehyperlinks, I get "The page cannot be Found" message. Theaddress bar indicates that the links are trying to load a filethat is located in the root of the website.

<asp:HyperLinkColumn DataNavigateUrlField="filename"DataTextField="filename"
HeaderText="File Name" />

How do I specify that I want the hyperlinks to open a file in thesubdirectory?
 
T

Thomas Dodds

use the DataNavigateUrlFormatString property ...

<asp:HyperLinkColumn DataNavigateUrlField="filename"
DataTextField="filename" HeaderText="File Name"
DataNavigateUrlFormatString="PUT YOU PATH HERE{0}" />
DataNavigateUrlFormatString="PUT YOU PATH HERE{0}" - what is happening:
{0} will instruct the server to insert the datavalue of the
DataNavigateUrlField as each item is bound ....


I am trying to set a field in a Datagrid to open a file located in the
downloads/ directory on my website. The following code creates hyperlinks in
my datagrid, but when I click on these hyperlinks, I get "The page cannot be
Found" message. The address bar indicates that the links are trying to load
a file that is located in the root of the website.

<asp:HyperLinkColumn DataNavigateUrlField="filename"
DataTextField="filename"
HeaderText="File Name" />

How do I specify that I want the hyperlinks to open a file in the
subdirectory?
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,479
Members
44,899
Latest member
RodneyMcAu

Latest Threads

Top