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

sanjaypandeyAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Bob LearnedCommented:
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
0
sanjaypandeyAuthor Commented:
yes, but the problem is I need to do this  based on a button click......  I generate a report url .
0
Bob LearnedCommented:
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
0
PMI ACP® Project Management

Prepare for the PMI Agile Certified Practitioner (PMI-ACP)® exam, which formally recognizes your knowledge of agile principles and your skill with agile techniques.

sanjaypandeyAuthor Commented:
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

0
Bob LearnedCommented:
Change this:

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

   to this:

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

That will remove the window name argument, and always open the window in a new browser window.

Bob
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
sanjaypandeyAuthor Commented:
Thanks , that did the trick
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
ASP.NET

From novice to tech pro — start learning today.