Solved

JavaScript - Open a new window with parameters

Posted on 2003-12-04
1
533 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
Comment Utility
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

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

Flash (http://en.wikipedia.org/wiki/Adobe_Flash) has evolved over the years to where it has become a masterful tool for displaying content screen.  It has excellent layout placement, UI precision as well as rendering capabilities. This, along with t…
This document covers how to connect to SQL Server and browse its contents.  It is meant for those new to Visual Studio and/or working with Microsoft SQL Server.  It is not a guide to building SQL Server database connections in your code.  This is mo…
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

771 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

9 Experts available now in Live!

Get 1:1 Help Now