Wrox Programmer Forums
| Search | Today's Posts | Mark Forums Read
ASP.NET 1.0 and 1.1 Basics ASP.NET discussion for users new to coding in ASP.NET 1.0 or 1.1. NOT for the older "classic" ASP 3 or the newer ASP.NET 2.0.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 1.0 and 1.1 Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old July 15th, 2004, 12:34 AM
Authorized User
 
Join Date: Feb 2004
Location: Delhi, Delhi, India.
Posts: 71
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to mahulda
Default <href> causing problems

I wanted to create a link to a file called "c:/some file.doc"
Consider the follwing lines

dim strlink as string = "c:/some file.doc" ' Some file is the name of the file
label1.text = "<a href = " & strlink & ">Click here</a>"
                 'where label1 is a Label

when I run this code the link gets created to c:/some

Using Hyperlinks is not something that can be done.

__________________
-.. -..
 
Old July 15th, 2004, 12:43 AM
Friend of Wrox
Points: 2,376, Level: 20
Points: 2,376, Level: 20 Points: 2,376, Level: 20 Points: 2,376, Level: 20
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: , , Australia.
Posts: 596
Thanks: 1
Thanked 3 Times in 3 Posts
Default

Im not sure about using a label for this, there is a literal control or a hyperlink control which would be better suited.

However, in either case c:/ refers to your local disk, the user of a website does not have access to that directory.
You would need to store the page in a directory within the website and use the site address to locate link to hte file.


dim strlink as string = "http://www.yoursite.com/some file.doc"
or
dim strlink as string = "http://localhost/some file.doc"

' Some file is the name of the file
literal1.text = "<a href = " & strlink & ">Click here</a>"
                 'where literal1 is a literal control


======================================
They say, best men are molded out of faults,
And, for the most, become much more the better
For being a little bad.
======================================
 
Old July 15th, 2004, 04:17 AM
Authorized User
 
Join Date: Feb 2004
Location: Delhi, Delhi, India.
Posts: 71
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to mahulda
Default

The c:/ was just an example .
Actually the file is located in a server.

I changed over to literal control but the problem remained.
Even in the reply by rodmcleay the two links are formed only till the white space character(i.e. till localhost/some ).

 
Old July 15th, 2004, 08:12 AM
Friend of Wrox
Points: 2,473, Level: 20
Points: 2,473, Level: 20 Points: 2,473, Level: 20 Points: 2,473, Level: 20
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: May 2004
Location: India
Posts: 642
Thanks: 0
Thanked 43 Times in 42 Posts
Default

Please modify the code as:

dim strlink as string = "c:/some file.doc" ' Some file is the name of the file
label1.text = "<a href = """ & strlink & """>Click here</a>"


Om Prakash
 
Old July 15th, 2004, 08:32 AM
Friend of Wrox
 
Join Date: Jun 2003
Location: Bangalore, KA, India.
Posts: 2,480
Thanks: 0
Thanked 1 Time in 1 Post
Default

As an alternate, you can also use SINGLE quotes.

Code:
label1.text = "<a href = '" & strlink & "'>Click here</a>"
Cheers!

_________________________
- Vijay G
Strive for Perfection
 
Old July 15th, 2004, 12:15 PM
Friend of Wrox
 
Join Date: Jun 2003
Location: Harrisburg, PA, USA.
Posts: 1,998
Thanks: 0
Thanked 3 Times in 3 Posts
Default

You may even be able to get away without any quotes if you use the %20 character for the space (I believe that's the right one).

Brian




Similar Threads
Thread Thread Starter Forum Replies Last Post
<a href="#"></a> crmpicco HTML Code Clinic 1 April 1st, 2005 01:17 AM
Including XSL in an <a href> graywoodhouse XSLT 2 November 12th, 2004 06:08 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.