Quantcast
Viewing all articles
Browse latest Browse all 3636

Issue with crystalreportviewer navigating with report with parameters asp.net

Hi Im trying to load crystal reports on a webpage. The report load fine and navigates fine if I dont have any parameters in the report.

But when I load a report with parameters its shows the parameter dialog and loads the first page fine but when I click next page or print the parameter dialog apears again and shows the first page again. Bellow is a copy of my code. If anyone has sudgestions how i can handle this I would be greatly appricated. I cant assign parameters via code as the reports are different and each one has unique parameters so it uses the reportviewer web control to ask for parameters.

 

thanks in advance

 

 

Imports CrystalDecisions.CrystalReports.Engine

Imports CrystalDecisions.Shared

Imports CrystalDecisions.Web

 

 

PublicClassReportViewer

    Inherits System.Web.UI.Page

 

    Private oRpt AsNewReportDocument()

   

    Private df AsDataDefinition

    FriendShared aspx AsObject


PrivateSub ReportViewer_Init(sender AsObject, e As System.EventArgs) HandlesMe.Init

 

        IfNot IsPostBack Then

            BindReport(Request.QueryString("field1"))

 

        Else

 

            With CrystalReportViewer1

 

 

 

                .ParameterFieldInfo = Session("ParamFieldInfo")

 

                .ReportSource = Session("ReportSource")

 

 

            EndWith

        EndIf

 

    EndSub

 

    ProtectedSub Page_Load(ByVal sender AsObject, ByVal e As System.EventArgs) HandlesMe.Load

 

        IfNot IsPostBack Then

            BindReport(Request.QueryString("field1"))

        Else

 

            With CrystalReportViewer1

 

                ' .DisplayGroupTree = False

 

                .ParameterFieldInfo = Session("ParamFieldInfo")

 

                .ReportSource = Session("ReportSource")

 

 

            EndWith

        EndIf

 

 

    EndSub

 

PrivateSub CrystalReportViewer1_Navigate(source AsObject, e As CrystalDecisions.Web.NavigateEventArgs) Handles CrystalReportViewer1.Navigate

 

        BindReport(Request.QueryString("field1"))

    EndSub

 

 

 

    PrivateSub BindReport(RptPath AsString)

 

        If Session("ReportSource") IsNothingThen

       

 

            Dim rep AsNewReportDocument

 

            rep.Load(Server.MapPath(RptPath))

 

            Me.CrystalReportViewer1.ReportSource = rep

 

 

            Session("ReportSource") = rep

 

            With CrystalReportViewer1

 

                .ParameterFieldInfo = Session("ParamFieldInfo")

                .ReportSource = Session("ReportSource")

                .DataBind()

            EndWith

        EndIf

 

 

    EndSub


Viewing all articles
Browse latest Browse all 3636

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>