#1
  1. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Nov 2010
    Posts
    39
    Rep Power
    5

    Building hyper links in asp


    Hi,

    I am displaying the data from databse. which is in table format.

    If I click on particualr row it will create a default hyperlink with that table row data..

    There are some spaces between the words..
    For that how can i build the hyper link..

    here is the code:

    Code:
    <a href="<%=rs("product_name")%>.asp"><%=rs("product_name")%></a>
    my sql table data has
    product name:
    wheat
    wheat flour

    here there is a space between two words..
    With that code it can only possible for first row..

    I don't know how to give space in the code to avoid..


    Thanks ..

    http://www.powerasp.com/content/new/building-hyperlinks.asp

    Plz let me know any one know about this
  2. #2
  3. No Profile Picture
    Grumpier old Moderator
    Devshed Supreme Being (6500+ posts)

    Join Date
    Jun 2003
    Posts
    14,453
    Rep Power
    4539
    Try
    Code:
    <a href="""<%=rs("product_name")%>.asp"""><%=rs("product_name")%></a>
    ======
    Doug G
    ======
    Bartender to Rene Descartes "have another beer?" Descartes: "I think not" and he vanished.
    --Alfred Bester
  4. #3
  5. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Nov 2010
    Posts
    39
    Rep Power
    5
    @ doug,

    It's not working..

    If it has more than two spaces how can it will accept
    data has

    dev shed forums.

    For this how will you specify..Here there are more than one space between words.

    and one more thing that data is coming from database.I am displaying as link. So if there is space in sql table data it is adding % symbols in file name for that..But real time it is not good way to give file name like that.
  6. #4
  7. No Profile Picture
    Grumpier old Moderator
    Devshed Supreme Being (6500+ posts)

    Join Date
    Jun 2003
    Posts
    14,453
    Rep Power
    4539
    Look at the page source in your browser. There needs to be quotes around an attribute like href=, which is what the extra double quotes in the snip I posted should do for you.

    If your spaces are being transformed to html entities than you have some other code somewhere doing the transformation with something like server.htmlencode()
    ======
    Doug G
    ======
    Bartender to Rene Descartes "have another beer?" Descartes: "I think not" and he vanished.
    --Alfred Bester
  8. #5
  9. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Nov 2010
    Posts
    39
    Rep Power
    5
    I am creating an hyperlink for database fields. What if they have spaces in table data.

    product name:
    dev shed forums
    ms office

    it is creating a file name like this..

    http:/localhost/test/dev%20shed%20Forums.asp

    then how can i create an asp file like this..How to name an asp file for that.

    Becoz i want to display some data in that each field in databse table..

    I have used same statement you have given there..
  10. #6
  11. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Nov 2010
    Posts
    39
    Rep Power
    5
    can you give more information on htmlencode...
  12. #7
  13. No Profile Picture
    Grumpier old Moderator
    Devshed Supreme Being (6500+ posts)

    Join Date
    Jun 2003
    Posts
    14,453
    Rep Power
    4539
    ======
    Doug G
    ======
    Bartender to Rene Descartes "have another beer?" Descartes: "I think not" and he vanished.
    --Alfred Bester

IMN logo majestic logo threadwatch logo seochat tools logo