473,386 Members | 1,785 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

apostrophe in href path

Hi all,

I'm trying to create a clickable link, but the pesky apostrophe is
preventing the link from getting displayed properly. I'm displaying the
contents of a folder (with contains the apostrophe), with the filename as a
clickable link. The files show up properly, but the link location cuts off at
the apostrophe.

Here's a code snippet (fi is an instance of FileInfo):

string fileList = "";

fileList = ("<a href='" + strFolderNameWithApos + "\\" + fi.Name + "'>" +
fi.Name + "</a>");

labelText.Text = fileList;

I've tried replacing the apostrophe with
a double apostrophe
%27
'
&apos;

but because of the href=' ....' it interprets it literally. Other than
renaming the folder without an apostrophe, is there a way around this?

Thanks in advance.
Mar 31 '06 #1
1 4003
HttpServerUtility.UrlEncode is your answer.

--
HTH,

Kevin Spencer
Microsoft MVP
Professional Numbskull

Show me your certification without works,
and I'll show my certification
*by* my works.

"Rose" <Ro**@discussions.microsoft.com> wrote in message
news:B8**********************************@microsof t.com...
Hi all,

I'm trying to create a clickable link, but the pesky apostrophe is
preventing the link from getting displayed properly. I'm displaying the
contents of a folder (with contains the apostrophe), with the filename as
a
clickable link. The files show up properly, but the link location cuts off
at
the apostrophe.

Here's a code snippet (fi is an instance of FileInfo):

string fileList = "";

fileList = ("<a href='" + strFolderNameWithApos + "\\" + fi.Name + "'>" +
fi.Name + "</a>");

labelText.Text = fileList;

I've tried replacing the apostrophe with
a double apostrophe
%27
'
&apos;

but because of the href=' ....' it interprets it literally. Other than
renaming the folder without an apostrophe, is there a way around this?

Thanks in advance.

Mar 31 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: InvisibleMan | last post by:
Thank in advance for your help... I have the following javascript: document.write(' <a class="whitenav" href="javascript:window.external.AddFavorite ('http://www.mydomain.com','Welcome to...
13
by: Richard Hollenbeck | last post by:
To prevent future apostrophe bugs and errors, isn't it just simpler to forbid an apostrophe from being entered into a text field? For example, couldn't "Alice's Restaurant" be changed to "Alices...
14
by: Adnan Siddiqi | last post by:
Hi Suppose I have following URLs comming from an HTML document <a href="http://mydomain1.com">Domain1</a> <a...
1
by: tim.landgraf | last post by:
hi there, i am experiencing a strange problem. i am iterating through a given directory, selecting only jpg - images that are then resized and inserted into a database. everything works, but if...
5
by: =?Utf-8?B?TEtOZXdzR3JvdXBz?= | last post by:
Hi I have a list which pulls out items from a stored procedure. Unfortunately some of the items it pulls out have apostrophes. This info need to be placed in a URL but it keeps truncating at the...
1
by: infodemers | last post by:
Hi everyone, I have the following code: <asp:TemplateField> <ItemTemplate> <a...
9
by: Thomas 'PointedEars' Lahn | last post by:
Jukka K. Korpela wrote: IBTD. For example, in English it is customary (and AIUI expected) to use the character that ’ represents should be used to delimit a quotation within direct speech...
4
by: viki1967 | last post by:
Hi all. I have problem with this code javascript: <input type="submit" name="Submit" value="Go" onclick="if(confirm('Confirm?')) location.href='page.asp?DES=Try after 1' minute'; return...
2
by: tasteofchaos | last post by:
Hey guys, Small problem... On my site: <Link removed> Apostrophes stop any more text after it showing in link titles.
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.