Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 1.0 and 1.1 > ASP.NET 1.0 and 1.1 Basics
Password Reminder
Register
Register | FAQ | Members List | Calendar | 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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
 
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
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.

__________________
-.. -..
  #2 (permalink)  
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.
======================================
  #3 (permalink)  
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 ).

  #4 (permalink)  
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
  #5 (permalink)  
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
  #6 (permalink)  
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
 


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


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



All times are GMT -4. The time now is 04:10 AM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.