Solved

JavaScript - Open a new window with parameters

Posted on 2003-12-04
1
539 Views
Last Modified: 2008-02-26
I have to open a new window from my ASP.net web application.

Here is the code I've been using.

Dim strScript As String = "<script language='javascript'>" & vbCrLf
strScript += " function window.onload() {" & vbCrLf
strScript += "    window.open('POREP01.aspx'); }" & vbCrLf
strScript += "</script>" & vbCrLf

Me.RegisterClientScriptBlock("strScript", strScript)

This works fine. But now I hwve to do the same thing on another page with parameters...and I am not able to place the parameters in Javascript, being new to JavaScript. Here is an example of a page which I have to open in a new window.

OrderpreviewPO.aspx?ordernumber=" & Me.ddlOrderNumber.SelectedItem.Value


0
Comment
Question by:Priya25
1 Comment
 
LVL 29

Accepted Solution

by:
David H.H.Lee earned 75 total points
ID: 9873211
Priya25,
Try this :

        Dim ParentLoadScript As String
        Dim strURL As String

        If IsPostBack Then
            strURL = "POREP01.aspx?ordernumber=" + Me.ddlOrderNumber.SelectedValue.ToString
            ParentLoadScript = "<script language=javascript>"
            ParentLoadScript &= "window.open('" + strURL + "');"
            ParentLoadScript &= "</" & "script>"
        End If

        If Not IsClientScriptBlockRegistered("ParentLoad") Then
            RegisterClientScriptBlock("ParentLoad", ParentLoadScript)
        End If

Regards
x_com
0

Featured Post

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

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

A basic question.. “What is the Garbage Collector?” The usual answer given back: “Garbage collector is a background thread run by the CLR for freeing up the memory space used by the objects which are no longer used by the program.” I wondered …
Today I had a very interesting conundrum that had to get solved quickly. Needless to say, it wasn't resolved quickly because when we needed it we were very rushed, but as soon as the conference call was over and I took a step back I saw the correct …
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…

809 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