?
Solved

Open file with hyperlink in Gridview

Posted on 2006-07-19
2
Medium Priority
?
5,136 Views
Last Modified: 2012-06-27
Hi,
My project is to display content from an oracle database table in a Gridview,
one of the field "filename" in the table give me the name of the file I would like to open through an hyperlink.
I just found the necessary code to setup one of the column in the gridview as hyperlink,
unfortunately the link does not open the file.
by example, the file is called
Johson Peter fee.doc and is stored in a network share "P:\Client_L-Z\Johson Peter fee.doc" and the filename in oracle table is "Johson Peter fee.doc" (VARCHAR, 255)
when I click on the hyperlink, the address in IE is shown as P:\Client_L-Z\Johnson%20Peter%20fee.doc
and the file does not open...if I replace the %20 by a blank (as in the oracle table) the file opens correctly...

I probably miss something but where ?

thanks for your help

this is the code

        <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False"
            DataKeyNames="FILEID" DataSourceID="SqlDataSource2" Width="100%" Font-Size="10pt">
            <Columns>
                <asp:BoundField DataField="FILEID" HeaderText="FILEID" ReadOnly="True" SortExpression="FILEID" Visible="False" />
                <asp:BoundField DataField="DESCRIPT" HeaderText="Type" SortExpression="DESCRIPT" >
                    <ControlStyle Font-Size="10pt" />
                </asp:BoundField>
                <asp:TemplateField HeaderText="Event">
                <ItemTemplate>
                <asp:HyperLink ID="HyperLink1" runat="server" NavigateUrl='<%# String.Format("P:/Client_L-Z/{0}", DataBinder.Eval(Container.DataItem,"FILENAME")) %>' Text="Go to event"></asp:HyperLink>
                </ItemTemplate>
                </asp:TemplateField>
                <asp:BoundField DataField="FILEDESCRIPTION" HeaderText="File Description" SortExpression="FILEDESCRIPTION" >
                    <ControlStyle Font-Size="10pt" />
                </asp:BoundField>
                <asp:BoundField DataField="PEOPLEID" HeaderText="PEOPLEID" SortExpression="PEOPLEID" Visible="False" />
            </Columns>
        </asp:GridView>
0
Comment
Question by:talentium
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
2 Comments
 
LVL 14

Accepted Solution

by:
Ramuncikas earned 500 total points
ID: 17136384
If you use IE as a default browser this will do a trick:
...
<asp:HyperLink ID="HyperLink1" runat="server" NavigateUrl='<%# String.Format("file:///P:/Client_L-Z/{0}", DataBinder.Eval(Container.DataItem,"FILENAME")) %>' Text="Go to event"></asp:HyperLink>
...
0
 
LVL 14

Expert Comment

by:Ramuncikas
ID: 17136403
Just checked - Firefox opens file too
0

Featured Post

Want to be a Web Developer? Get Certified Today!

Enroll in the Certified Web Development Professional course package to learn HTML, Javascript, and PHP. Build a solid foundation to work toward your dream job!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In my previous article (http://www.experts-exchange.com/Programming/Languages/.NET/.NET_Framework_3.x/A_4362-Serialization-in-NET-1.html) we saw the basics of serialization and how types/objects can be serialized to Binary format. In this blog we wi…
A long time ago (May 2011), I have written an article showing you how to create a DLL using Visual Studio 2005 to be hosted in SQL Server 2005. That was valid at that time and it is still valid if you are still using these versions. You can still re…
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…
Suggested Courses

743 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question