QueryString problem

Results 1 to 3 of 3

Thread: QueryString problem

  1. #1
    Join Date
    Dec 1969
    Posts
    36

    Default QueryString problem

    I have the following piece of code:<BR>&#060;a href=65itworks.asp?Name=" & rs(0)><BR>the problem is that rs(0) is a variable that has a space inside it and it&#039s only sending the first part of it... is the a way to solve this?<BR>Thanks<BR>Ariel

  2. #2
    Chris Willey Guest

    Default RE: QueryString problem

    Change the line to:<BR><BR>&#060;a href=65itworks.asp?Name=&#060;%=Server.URLEncode(r s(0))&#037;&#062;>

  3. #3
    Join Date
    Dec 1969
    Posts
    69

    Default QueryString and JavaScript

    Now, Chris gave you a solution, but I will give you a different one based on the same concept. I know this is an ASP Forum, but in would be a good idea to know that you can even encode url with JavaScript and still catch it with QueryString! JavaScript function escape() does the same job as URLEncode(). Example:<BR><BR>&#060;a href="javaScript:url_onClick()"><BR><BR>Where url_onClick is a function name (you can gave any you wish). JavaScript function would look something like:<BR><BR>function url_onClick() {<BR> url="65itworks.asp?Name=" + escape(&#060;%response.write strTemp&#037;&#062;)<BR> location=url<BR>}<BR><BR>Of course, befor thar you would have to assign strTemp (temporary ASP string) a value:<BR><BR>strTemp = Chr(34) & rs(0) & Chr(34)<BR><BR>Where Chr(34) stands for quotation mark.<BR><BR>Why JavaScript when you can resolve the problem in one line as Chris showed you? Well (some will disagre), if you have many links to create with long strings (100-200 characters, a lot of arguments etc.), you might consider a possibility to send to client only 5 line JavaScript function which will do that on "as needed bases" only once, insted calculating on server 10, 20 or more times and sending long strings to client.<BR><BR>Once again, this is ASP Forum, but I like combining things. For more info, feel free to contact me on stevang@mail.com<BR>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •