Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

JavaScript - Open a new window with parameters

Posted on 2003-12-04
1
Medium Priority
?
546 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
[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
1 Comment
 
LVL 29

Accepted Solution

by:
David H.H.Lee earned 300 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

Veeam Disaster Recovery in Microsoft Azure

Veeam PN for Microsoft Azure is a FREE solution designed to simplify and automate the setup of a DR site in Microsoft Azure using lightweight software-defined networking. It reduces the complexity of VPN deployments and is designed for businesses of ALL sizes.

Question has a verified solution.

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

A long time ago (May 2011), I have written an article showing you how to create a DLL using Visual Studio 2005 to be hosted in SQL Server 2005. That was valid at that time and it is still valid if you are still using these versions. You can still re…
This article shows how to deploy dynamic backgrounds to computers depending on the aspect ratio of display
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …
In response to a need for security and privacy, and to continue fostering an environment members can turn to for support, solutions, and education, Experts Exchange has created anonymous question capabilities. This new feature is available to our Pr…

670 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