[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

Open file with hyperlink in Gridview

Posted on 2006-07-19
2
Medium Priority
?
5,168 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

Fill in the form and get your FREE NFR key NOW!

Veeam® is happy to provide a FREE NFR server license to certified engineers, trainers, and bloggers.  It allows for the non‑production use of Veeam Agent for Microsoft Windows. This license is valid for five workstations and two servers.

Question has a verified solution.

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

The object model of .Net can be overwhelming at times – so overwhelming that quite trivial tasks often take hours of research. In this case, the task at hand was to populate the datagrid from SQL Server database in Visual Studio 2008 Windows applica…
In my previous two articles we discussed Binary Serialization (http://www.experts-exchange.com/A_4362.html) and XML Serialization (http://www.experts-exchange.com/A_4425.html). In this article we will try to know more about SOAP (Simple Object Acces…
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…
We’ve all felt that sense of false security before—locking down external access to a database or component and feeling like we’ve done all we need to do to secure company data. But that feeling is fleeting. Attacks these days can happen in many w…

649 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