Report Viewer loing选择NEXT PAGE时的参数

时间:2012-04-23 15:19:26

标签: javascript asp.net vb.net reporting-services

这很有趣。我将参数传递给它后打开一个新窗口。在这个新窗口中是我的reportviewer控件。我加载控件并显示所有显示,直到我点击VIEW NEXT PAGE按钮 - 它重新加载报告并从第1页开始。

任何想法????

CODE:

   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

2 个答案:

答案 0 :(得分: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"

MAC

答案 1 :(得分:-1)

不要在Page_Load事件中调用Set Report Properties。在像button_click这样的事件上调用它。