Solved

query string javascript

Posted on 2011-02-28
7
425 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
Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 
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

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

Join & Write a Comment

Suggested Solutions

Article by: DanRollins
This article describes a JavaScript program that creates a maze made of hexagonal cells.  In Part 2 (http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/A_7850-Hex-Maze-Part-2.html), we'll extend the program by adding a depth-…
The task A number given should be formatted for easy reading by separating digits into triads. Format must be made inline via JavaScript, i.e., frameworks / functions are not welcome. So let’s take a number like this “12345678.91¿ and format i…
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…

758 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now