473,396 Members | 1,773 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,396 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 4005
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: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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
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
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...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.