Solved

query string javascript

Posted on 2011-02-28
7
454 Views
Last Modified: 2012-05-11
My page APS gets passed a query string and the request it like this

Request.QueryString("Product_ID")

Now, in the following javascript procedure how would i pass this this query string to the PopupForm.aspx form that is being opened?

  function OpenChild() {

        var WinSettings = "center:yes;resizable:no;dialogHeight:300px"
        // ALTER BELOW LINE - supply correct URL for Child Form
        var MyArgs = window.showModalDialog("../PopupForm.aspx", MyArgs, WinSettings);

    }
0
Comment
Question by:vbnetcoder
  • 3
  • 3
7 Comments
 
LVL 82

Expert Comment

by:leakim971
ID: 35000221
try :

function OpenChild() {

        var WinSettings = "center:yes;resizable:no;dialogHeight:300px"
        // ALTER BELOW LINE - supply correct URL for Child Form
        var pid = "1234";
        var MyArgs = window.showModalDialog("../PopupForm.aspx?Product_ID=" + pid, MyArgs, WinSettings);

    }

Open in new window

0
 

Author Comment

by:vbnetcoder
ID: 35000337
OK the passing to the new form works find but how do i get the value of product_ID that was passed to the form?
0
 
LVL 29

Accepted Solution

by:
Paul Jackson earned 500 total points
ID: 35000393
Put this in your page to defiine a javascript variable that can be used in the function:
<% Response.write("<script language='javascript'>var prodid = " & Request.QueryString("Product_ID") & ";</script>")%>

The use this variable to pass the product id as a querystring:
function OpenChild() {

        var WinSettings = "center:yes;resizable:no;dialogHeight:300px"
        // ALTER BELOW LINE - supply correct URL for Child Form
        var MyArgs = window.showModalDialog("../PopupForm.aspx?Product_ID="+ prodid, MyArgs, WinSettings);

    }
0
Ransomware: The New Cyber Threat & How to Stop It

This infographic explains ransomware, type of malware that blocks access to your files or your systems and holds them hostage until a ransom is paid. It also examines the different types of ransomware and explains what you can do to thwart this sinister online threat.  

 
LVL 29

Expert Comment

by:Paul Jackson
ID: 35000404
Request.Querystring("Product_ID") can then be used on the child form to get the product id
0
 

Author Comment

by:vbnetcoder
ID: 35000509
Where do i put this line of code that you gave me above:

<% Response.write("<script language='javascript'>var prodid = " & Request.QueryString("Product_ID") & ";</script>")%>



0
 
LVL 29

Expert Comment

by:Paul Jackson
ID: 35000568
Put it in your aspx page just above your javascript functions.
0
 

Author Closing Comment

by:vbnetcoder
ID: 35000601
ty
0

Featured Post

Best Practices: Disaster Recovery Testing

Besides backup, any IT division should have a disaster recovery plan. You will find a few tips below relating to the development of such a plan and to what issues one should pay special attention in the course of backup planning.

Question has a verified solution.

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

ASP.Net to Oracle Connectivity Recently I had to develop an ASP.NET application connecting to an Oracle database.As I am doing it first time ,I had to solve several problems. This article will help to such developers  to develop an ASP.NET client…
This article will give core knowledge of JavaScript and will head in to your first JavaScript program. I am Durvesh Naik and I am here to deal with this series of JavaScript. I will teach you JavaScript in part wise , as its quite boring to read big…
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…

777 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