Solved

pass a query string on a buttonclick

Posted on 2001-09-14
6
216 Views
Last Modified: 2008-02-01
I have a query string and when i click a button, that query string should be passed as a URL for the next page in the same window... Using ......

Window.Location.href="asp1.asp?Title=<% =Request.QueryString("xyz") %>

This is an example of how i tried for a Title field from a database.

the error i encountered was "Unterminated String Constant"...

The eror code is 1033. I hope iam correct...If anyone can help me sure do mail me soon........


S.Ramanujam (ramanujam@clearexperts.com)clearExpertsSolutions (p) Ltd,
A3, "CEEBROS RANGAM",
No.11, Cenatoph Road,
Teynampet, Chennai - 18

Phone: +91-44-4334619(off)
       +91-44-4334634(off)
       +91-44-3722375(res)

0
Comment
Question by:ramanujamsampath
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
6 Comments
 
LVL 3

Expert Comment

by:bigbed
ID: 6482346
You have href="....
then you have another double-quoted string within it ("xyz"), and you don't have the terminating double-quote for the href attribute.

You need to escape the double-quotes in the QueryString("xyz") call, or use single-quotes there. And you need to add the closing double-quote.
Example using single-quote inside double-quotes (assuming single-quotes are legal in your ASP):
Window.Location.href="asp1.asp?Title=<% =Request.QueryString('xyz') %>"

0
 
LVL 5

Expert Comment

by:aryumin
ID: 6482364
Window.Location.href="asp1.asp?Title=<% =Server.URLEncode(Request.QueryString("xyz")) %>
0
 
LVL 5

Expert Comment

by:aryumin
ID: 6482372
Oops. Forget a closing quote :(
Window.Location.href="asp1.asp?Title=<% =Server.URLEncode(Request.QueryString("xyz")) %>";
0
PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

 
LVL 75

Accepted Solution

by:
Michel Plungjan earned 50 total points
ID: 6482846
and to make it valid javascript you need to lowercase it and href is not needed to SET the url:
window.location="asp1.asp?Title=<% =Server.URLEncode(Request.QueryString("xyz")) %>";

Michel
0
 

Author Comment

by:ramanujamsampath
ID: 6486651
Thanx a lot for a wonderful answer..... It really worked at the first trial itself...

Ai. Alevidae
Cheers

S.Ramanujam (ramanujam@clearexperts.com)clearExpertsSolutions (p) Ltd,
A3, "CEEBROS RANGAM",
No.11, Cenatoph Road,
Teynampet, Chennai - 18

Phone: +91-44-4334619(off)
       +91-44-4334634(off)
       +91-44-3722375(res)

0
 
LVL 75

Expert Comment

by:Michel Plungjan
ID: 6486945
Sorry guys - just making a comment - not trying to poach the question

Michel
0

Featured Post

Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In my daily work (mainly using ASP.net), I need to write a lot of JavaScript code. One of the most repetitive tasks I do are the jQuery Ajax calls. You know: (CODE) I don't know if for you it's the same, but for me is soooo tedious to write the …
Having worked on larger scale sites, we found out that you are bound to look at more scalable solutions to integrating widgets, code snippets or complete applications and mesh them into functional sites, in any given composition. To share some of…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

726 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question