[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

How do I avoid encoding when using asp:hyerlink and the navigateurl property?

Posted on 2009-05-14
4
Medium Priority
?
1,115 Views
Last Modified: 2012-05-07
I have a link in a database to a file on our network :
G:/Formatted CVs/FormattedCV_Ackerman_J_106485.doc
however when the link outputs to the browser it gets encoded to contain :
file:///G:/Formatted%2520CVs/FormattedCV_Ackerman_J_106485.doc
The %2520 stops the link working in IE7.  I can I prevent this encoding or should I use another control to output my hyperlink?

<asp:HyperLink ID="HyperLink1" runat="server" NavigateUrl='<%#"file://" & Eval("ProformaLink").tostring %>'  Target="_blank">
<asp:Literal ID="Literal2" runat="server" Text='Link'/>
</asp:HyperLink>

Open in new window

0
Comment
Question by:dgloveruk
  • 2
4 Comments
 
LVL 14

Expert Comment

by:GiftsonDJohn
ID: 24383683
Try this

<asp:HyperLink ID="HyperLink1" runat="server" NavigateUrl='<%# Server.UrlDecode(string.Format("file://{0}", Eval("ProformaLink")))%>'  Target="_blank">
<asp:Literal ID="Literal2" runat="server" Text='Link'/>
</asp:HyperLink>
0
 

Author Comment

by:dgloveruk
ID: 24383824
Nope, sadly this generated the same link and the same problem.
Any other ideas?
0
 
LVL 12

Accepted Solution

by:
GuitarRich earned 2000 total points
ID: 24383856
the NavigateUrl property will UrlEncode the data going into it - can you change it to a standard hyperlink?
<a href='<%#"file://" & Eval("ProformaLink").tostring %>'  Target="_blank">
<asp:Literal ID="Literal2" runat="server" Text='Link'/>
</a>

Open in new window

0
 

Author Closing Comment

by:dgloveruk
ID: 31581391
That did the trick, I had a go at this before but wasn't able to get a syntax it was happy with, cheers!
0

Featured Post

Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

Question has a verified solution.

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

I recently went through the process of creating a Calendar Control of events with the basis of using a database to keep track of the dates that are selectable, one requirement was to have the selected date pop-up in a simple lightbox.  At first this…
In .NET 2.0, Microsoft introduced the Web Site.  This was the default way to create a web Project in Visual Studio 2005.  In Visual Studio 2008, the Web Application has been restored as the default web Project in Visual Studio/.NET 3.x The Web Si…
Look below the covers at a subform control , and the form that is inside it. Explore properties and see how easy it is to aggregate, get statistics, and synchronize results for your data. A Microsoft Access subform is used to show relevant calcul…
Whether it be Exchange Server Crash Issues, Dirty Shutdown Errors or Failed to mount error, Stellar Phoenix Mailbox Exchange Recovery has always got your back. With the help of its easy to understand user interface and 3 simple steps recovery proced…
Suggested Courses
Course of the Month20 days, 7 hours left to enroll

868 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