0

这是一个有趣的。将参数传递给它后,我会打开一个新窗口。在这个新窗口中是我的报表查看器控件。我加载控件并且所有显示都很好,直到我单击查看下一页按钮 - 它重新加载报告并再次从第 1 页开始。

有任何想法吗????

代码:

   Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        Dim strTitle As String
        Dim strReportName As String
        Dim tstr As String

        tstr = "-o-"
        strReportName = ""
        strTitle = "Praxima CENTAURI Report Viewer : REPORT : "

        'If Not IsPostBack Then
        If Not String.IsNullOrEmpty(Request.QueryString("prm")) Then
            tstr = Request.QueryString("prm").ToString()
        End If
        'End If

        'tstr = Request.QueryString("prm").ToString()
        Me.Title = tstr 'strTitle + strReportName
        SetReportProperties(tstr)
    End Sub
    Private Sub SetReportProperties(ByVal CSVString As String)
        Dim paramList As Generic.List(Of ReportParameter) = New Generic.List(Of ReportParameter)()
        With ReportViewer1
            .ProcessingMode = Microsoft.Reporting.WebForms.ProcessingMode.Remote
            With .ServerReport
                Dim PParm(0) As String
                Dim PValue(0) As String
                Dim cnt As Integer = 1
                Dim AType As String = "P"
                Dim Marker As Integer = 1
                Dim Pcnt As Integer = 0
                Dim Vcnt As Integer = 0
                Dim iLoop as Integer
                For cnt = 1 To Len(CSVString)

                    If Mid(CSVString, cnt, 1) = "," And AType = "P" Then
                        ReDim Preserve PParm(Pcnt)
                        PParm(Pcnt) = Mid(CSVString, Marker, cnt - Marker)
                        'CSVString = Mid(CSVString, cnt + 1, Len(CSVString) - cnt)
                        cnt = cnt + 1
                        AType = "V"
                        Marker = cnt
                        Pcnt = Pcnt + 1
                    End If
                    If Mid(CSVString, cnt, 1) = "," And AType = "V" Or cnt = Len(CSVString) Then
                        ReDim Preserve PValue(Vcnt)
                        If cnt = Len(CSVString) Then
                            PValue(Vcnt) = Mid(CSVString, Marker, (cnt - Marker) + 1)
                        Else

                            PValue(Vcnt) = Mid(CSVString, Marker, cnt - Marker)
                        End If
                        'CSVString = Mid(CSVString, cnt + 1, Len(CSVString) - cnt)
                        cnt = cnt + 1
                        AType = "P"
                        Marker = cnt
                        Vcnt = Vcnt + 1
                    End If

                    '                   Dim pUri As New Uri(PValue(0))


                Next
                .ReportServerUrl = New Uri("http://localhost/reportserver")  'New Uri(PValue(0).ToString)
                .ReportPath = "/praxima/rptZZ-FullPayDetails" 'PValue(1)


                Dim pinfo As ReportParameterInfoCollection = .GetParameters()
                Dim Parray As Integer = 1
                For Each p As ReportParameterInfo In pinfo
                    Parray = Parray + 1
                    If Parray > 1 And Parray < pinfo.Count Then
                        paramList.Add(New ReportParameter(PParm(Parray).ToString, PValue(Parray).ToString))
                    End If
                Next



                If paramList.Count > 0 Then
                    'MsgBox(paramList.Item(2).Values.Item(1).ToString, vbOKOnly, )

                    .SetParameters(paramList)

                End If


            End With
            .ShowParameterPrompts = False

        End With


    End Sub
4

2 回答 2

0

我直接打电话给报告,而不是担心屏幕上有花哨的标志等。我正在使用 CSS 样式表来“美化”报告。

<title>Untitled Page</title>
<script type="text/javascript">
    function open_win()
        {
            var Parms = document.getElementById('PassParmString').value;
            window.open(Parms)

}

传递的参数字符串如下所示:

Me.PassParmString.Text = Me.PassParmString.Text + "&ClientName=ZZZZ&StartDateString=2011/01/01&EndDateString=2011/01/31&GiveBlankOutput=Yes&Level2From= &Level2To=ZZZZZZZZ&Level3From= &Level3To=ZZZZZZZZ&Level4From= &Level4To=ZZZZZZZZ&Level5From= &Level5To=ZZZZZZZZ&EmpNumFrom= &EmpNumTo=ZZZZZZZZ&EmpNameFrom= &EmpNameTo=ZZZZZZZZ&CostCentFrom= &CostCentTo=ZZZZZZZZ&OutputSeq=Name&EntireYear=No&StartYearString=2011-03-01"

苹果电脑

于 2012-04-24T09:52:42.513 回答
-1

不要在 Page_Load 事件中调用 SetReportProperties。在 button_click 之类的事件上调用它。

于 2013-12-15T23:53:56.877 回答