none
javascript:void(window.open(

    Question

  • I am using javascript:void(window.open('http:// .. command to open report from one report to launch another report in a seperate window which works fine.

    The problem I am facing is when I call another report from the report called by javascript.

    1. A Report launched  -> B Report in a seperate window using javascript:void(working fine)
    2. B Report launched -> C Report in a seperate window using javascript:void(working fine)
    3. A Report launch->B Report launch-> C Report

    The problem happens in last scenario 3 when C Report is called. It opens 2 windows - one with real report with proper syntax - http://localhost/ReportServer/Pages/ReportViewer.aspx?/xx&rs:Command=Render&rc:LinkTarget=_blank and another with syntax error of javascript-
    javascript:void(window.open('http://localhost/ReportServer/Pages/ReportViewer.aspx?%2fxx&rs:Command=Render&rc:LinkTarget=_blank'))

    What is the problem going here?

    Sunday, December 20, 2009 12:33 AM

Answers

  • I resolved it by introducing a parameter. If a report was called from first level then I execute using javascript syntax otherwise simple URL syntax.
    • Marked as answer by Virgo2008 Tuesday, January 05, 2010 10:28 PM
    Tuesday, January 05, 2010 10:27 PM

All replies

  • Hi,

    Is there any relation between these 3 reports? You should post the 3 Javascript codes here you wrote.

    thanks,
    Jerry
    Wednesday, December 23, 2009 3:47 AM
    Moderator
  • All the 3 javascript are same except reports are different.
    javascript:void(window.open('http://localhost/ReportServer/Pages/ReportViewer.aspx?%2fxx&rs:Command=Render&rc:LinkTarget=_blank'))
    like instead of xx, put yy, etc. It does not matter.

    Though I resolved this problem using variable. When reportA is called the variable is 1 so it will call reportb with javascript code and now Reportb calls ReportC the level is 2 so it will call reportc without javascript then it works.

    Function GetHyperLink(ReportUrl as String, paramLevel as integer) as String
        Dim s as String
        s=""
        dim URLlen as integer
        URLlen =len(ReportUrl)
        if ReportUrl.toupper()= "LOCALHOST:85" then
        if paramLevel = 1 then
        s =s+ "http://localhost:85"
        else
        s =s+ "javascript:void(window.open('http://localhost:85"
        end if
        else
        if URLlen>7 then
        if paramLevel = 2 then
        s = s+"javascript:void(window.open('http://"+LEft(ReportUrl.SubString(7),ReportUrl.SubString(7).IndexOf("/"))
        else
        s = s+"http://"+LEft(ReportUrl.SubString(7),ReportUrl.SubString(7).IndexOf("/"))
        end if
        end if
        end if

        s = s + "/ReportServer/Pages/ReportViewer.aspx?%2fReportFolder%2f"
        s=s+ "ReportA"
        if paramLevel = 2 then
          s = s +"&rs:Command=Render&rc:LinkTarget=_blank&rc:section=2'))"
        else
          s = s +"&rs:Command=Render&rc:LinkTarget=_blank&rc:section=2"
        end if

        return s
    End Function

    Wednesday, December 23, 2009 11:20 PM
  • I resolved it by introducing a parameter. If a report was called from first level then I execute using javascript syntax otherwise simple URL syntax.
    • Marked as answer by Virgo2008 Tuesday, January 05, 2010 10:28 PM
    Tuesday, January 05, 2010 10:27 PM