Link to home
Start Free TrialLog in
Avatar of sanjaypandey
sanjaypandey

asked on

open a new window from within another new browser window

Hi all,

I am using the code below that open a new browser window

Response.Write("<script>window.open ('" + varReportURL + "','_new', 'width=1200,height=600');</script>")


what I want it that I want to open another PDF link from this new browser window. when I am using this same code , its open the pdf in this same browser instead of opening a new window.

please help

Avatar of Bob Learned
Bob Learned
Flag of United States of America image

You might be able to use the target attribute:

Open a link in a new browser window
http://www.w3schools.com/html/tryit.asp?filename=tryhtml_link_target

Bob
Avatar of sanjaypandey
sanjaypandey

ASKER

yes, but the problem is I need to do this  based on a button click......  I generate a report url .
If you are attaching this to a button, then don't use Response.Write, add to the onClick attribute:

Me.Button1.Attributes("onClick") = "javascript: window.open...

Also, leave the window name blank to get a new window, instead of reusing an existing window with the same name.

Bob
I see what you are saying but then I need to execute some vb.net code on button click.. that except the parameter from the user... generate report on the server and then the generated url is what I need to open in a new window.


Dim varP1, varP2, varP3 As String
        Dim varModelName As String
        Dim varReportURL As String
        Dim varPARAMETERS As String
 
        Dim j As Integer
        Dim i As Integer
        j = 0
        varP1 = ""
        varP2 = ""
        varP3 = ""
 
        For i = 0 To (lstboxProposal.Items.Count - 1)
            If lstboxProposal.Items(i).Selected = True Then
                j = j + 1
                If j = 1 Then
                    varP1 = lstboxProposal.SelectedItem.Text
                ElseIf j = 2 Then
                    varP2 = lstboxProposal.SelectedItem.Text
                ElseIf j = 3 Then
                    varP3 = lstboxProposal.SelectedItem.Text
                End If
            End If
        Next
        varModelName = Session("SelectedTblName")
        varPARAMETERS = "P1=" & varP1 & "&P2=" & varP2 & "&P3=" & varP3 & "&ModelName=" & varModelName
 varReportURL = "http://maroa/acweb/maroa/StrategicPolicyAnalysis/PPM.rox?Submit&__scheduleType=sync&__overwrite=new&" & Server.UrlEncode(varPARAMETERS)
 
        Response.Write("(<script>window.open('" + varReportURL + "','_new', 'width=1000,height=600');</script>")
   

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of Bob Learned
Bob Learned
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Thanks , that did the trick