Solved

query string javascript

Posted on 2011-02-28
7
477 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
[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
  • 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
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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

Salesforce Made Easy to Use

On-screen guidance at the moment of need enables you & your employees to focus on the core, you can now boost your adoption rates swiftly and simply with one easy tool.

Question has a verified solution.

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

Suggested Solutions

Problem Hi all,    While many today have fast Internet connection, there are many still who do not, or are connecting through devices with a slower connect, so light web pages and fast load times are still popular.    If your ASP.NET page …
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…

732 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