Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP General > Strings for Strings Query

Reply
Thread Tools

Strings for Strings Query

 
 
g
Guest
Posts: n/a
 
      11-08-2003
hi,

I intend to make a page that will display each categories under a main
category. This is done with XML. A piece of XML code as below.
<xml>
<Category name="Category1">
<Category name="Sub Category1"></Category>
<Category name="Sub Category2"></Category>
</Category>
<Category name="Category2"></Category>
<xml>
I manage to create a page that lay out all the main categories and
hyperlink them.

The problem is this , my hyperlink look like this : <a href
=category.asp?Category=Sub Category1 >

I need to make it look like this <a href
=category.asp?Category=Sub%20Category1 >

Other then SPACE have to be %20, ampersand have to be%26 so on and forth

Is there anyway to encode this: <a href =category.asp?Category=Sub
Category1 > to <a href =category.asp?Category=Sub%20Category1 >???


thank you for any help is given.

 
Reply With Quote
 
 
 
 
Steven Burn
Guest
Posts: n/a
 
      11-08-2003
Replace the spaces with the Replace function?

SomeString = Replace(SomeString, " ", "_")

--
Regards

Steven Burn
Ur I.T. Mate Group CEO
www.it-mate.co.uk

Disclaimer:
I know I'm probably wrong, I just like taking part ;o)


g <> wrote in message
news:boi1ln$p0a$...
> hi,
>
> I intend to make a page that will display each categories under a main
> category. This is done with XML. A piece of XML code as below.
> <xml>
> <Category name="Category1">
> <Category name="Sub Category1"></Category>
> <Category name="Sub Category2"></Category>
> </Category>
> <Category name="Category2"></Category>
> <xml>
> I manage to create a page that lay out all the main categories and
> hyperlink them.
>
> The problem is this , my hyperlink look like this : <a href
> =category.asp?Category=Sub Category1 >
>
> I need to make it look like this <a href
> =category.asp?Category=Sub%20Category1 >
>
> Other then SPACE have to be %20, ampersand have to be%26 so on and forth
>
> Is there anyway to encode this: <a href =category.asp?Category=Sub
> Category1 > to <a href =category.asp?Category=Sub%20Category1 >???
>
>
> thank you for any help is given.
>



 
Reply With Quote
 
 
 
 
Aaron Bertrand [MVP]
Guest
Posts: n/a
 
      11-08-2003
Your hyperlink should be:

response.write "<a href='category.asp?Category=" & server.URLEncode("Sub
Category 1") & "'>"

Also, rather than passing big bulky strings around in querystrings, consider
using a smaller primary key (like an integer)... you avoid the above
problem, you reduce overall network bandwidth, you make it less tempting for
people to guess categories by just typing whatever they want into the URL,
and you make it less imposing on users (who may have bookmarked a URL) when
you change "Sub Category 1" to "Sub Category 5"...




"g" <> wrote in message
news:boi1ln$p0a$...
> hi,
>
> I intend to make a page that will display each categories under a main
> category. This is done with XML. A piece of XML code as below.
> <xml>
> <Category name="Category1">
> <Category name="Sub Category1"></Category>
> <Category name="Sub Category2"></Category>
> </Category>
> <Category name="Category2"></Category>
> <xml>
> I manage to create a page that lay out all the main categories and
> hyperlink them.
>
> The problem is this , my hyperlink look like this : <a href
> =category.asp?Category=Sub Category1 >
>
> I need to make it look like this <a href
> =category.asp?Category=Sub%20Category1 >
>
> Other then SPACE have to be %20, ampersand have to be%26 so on and forth
>
> Is there anyway to encode this: <a href =category.asp?Category=Sub
> Category1 > to <a href =category.asp?Category=Sub%20Category1 >???
>
>
> thank you for any help is given.
>



 
Reply With Quote
 
 
 
Reply

Thread Tools

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 On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
ASP.NET won't retrieve query results that depend on union query Eric Nelson ASP .Net 5 02-04-2009 10:51 PM
Strings, Strings and Damned Strings Ben C Programming 14 06-24-2006 05:09 AM
Trying to query the Address table data of AdventureWorks database from Query Analyzer - need help! Learner ASP .Net 1 01-30-2006 08:58 PM
Build dynamic sql query for JSTL <sql:query> Anonymous Java 0 10-13-2005 10:01 PM
xpath query query David Gordon XML 2 05-18-2005 03:33 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57