Hello,
I am trying to open a txt file from a link in a gridview.
this is code i have,

<asp:GridView ID="GridView1" runat="server"  AutoGenerateColumns="false"
        EmptyDataText="No records found matching your criteria" Font-Bold="true">
    <Columns>
    <asp:BoundField DataField="file_name"  HeaderText="File Name"/>

    <asp:TemplateField HeaderText="Open">

    <ItemTemplate>
    <asp:HyperLink ID="Open" NavigateUrl='<%# Eval("file_name") %>' Text='<%# Eval("file_name") %>' runat="server" />    
    </ItemTemplate>    
    </asp:TemplateField>
 
</Columns>
    </asp:GridView>

The problem - when I take the mouse on the "Open" link it says- http://localhost//4444\abc.txt and the value of the file_name field is abc.txt (not C:\folder1\abc.txt) and it is not opening the file.

the location of file is C:\folder1\abc.txt
What I am doing wrong? Should I write any code from codebehind too? How do I open this file? Is there any another way? Please it is kind of urgent.

Thanks in advance.

Firstly, is the c:\folder1 on the server or the client machine?

If its the client machine you'd need to use file://C:/Folder1/abc.txt (that maybe file:///C:.. but cant remember)

if you mean on the server then folder1 has to be accessible from you website, if its not, then either, you have to do some working of a display asp system to read in a given file from outside the webtree, or, you move the folder.

thanks for replying.
Right now I am testing this application on my m/c. So the folder is in my m/c. But eventually the file will be on server. So how do I go @ it?

Like I suggested..

sorry I did not understand your answer. What should I write in my NavigateURL so that when I click on the hyperlink, my text file content will show up?

Please tell me with respect to the code.

Well as I said, the files would need to be within the directories accessible from your http server setup.

THEN, you need to either put in a fully qualified URL or, the correct relative path to pick up the files..