locked
Problem with Crystal Report ... Zoom Control RRS feed

  • Question

  • User-1509636757 posted

    Hi Everybody,

    im having problem with crystal report in asp.net 2.0.

    in page load event; im assigning the data source to the crystal reoport. (im not having page.isportback check in page load event)

    the report is working fine. when i use default zoom control to zoom the report at any level' it just zoom for one time only. then i again try to zoom the report; but report donesn't zoom this time.,

     for ex,

    first time im zooming the report to 400%; report will be zoom accordingly.

    again im zooming the report to 25%; still report is showing at 400% zoom not 25%; what it suppose to be.,

    pls help me......

    thanks in advance...

     here is the code.....

     Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
            Page.Title = "iCOM - " & Request.QueryString("PageType")
            Page.MaintainScrollPositionOnPostBack = True
            StartReport(Request.QueryString("PageType"), Request.QueryString("Offers"))
     End Sub

     

    Private Sub StartReport(ByVal strReportName As String, ByVal strReportCriteria As String)
            Try
                Dim DsReportData As DataSet
                DsReportData = FillDataSet(strReportName.ToUpper, strReportCriteria)
                If DsReportData.Tables(0).Rows.Count = 0 Then
                    Exit Sub
                End If

                If CrystalReportViewer1.DisplayGroupTree <> True Then
                    CrystalReportViewer1.DisplayGroupTree = False
                End If
                CrystalReportViewer1.HasCrystalLogo = False

                Dim myReportDocument As ReportDocument
                myReportDocument = New ReportDocument()

                Try
                    Select Case strReportName.ToUpper
                        Case "BILL OF MATERIAL"
                            myReportDocument.Load(Server.MapPath(".") & "\RPT_BillOfMaterial.rpt")
                        Case "CIRCUIT ESTIMATION"
                            myReportDocument.Load(Server.MapPath(".") & "\RPT_CircuitEstimation.rpt")
                        Case "CIRCUIT ESTIMATION SUMMARY"
                            myReportDocument.Load(Server.MapPath(".") & "\RPT_EstimationSummary.rpt")
                        Case "BOUGHT OUT ITEM ESTIMATION"
                            myReportDocument.Load(Server.MapPath(".") & "\RPT_BoughtOutItemEstimation.rpt")
                        Case "PROJECT ESTIMATION SUMMARY"
                            myReportDocument.Load(Server.MapPath(".") & "\RPT_ProjectEstimation.rpt")
                    End Select
                Catch ex As Exception
                    'clsFunctions.Client_Alert(ex.Message)
                    Exit Sub
                End Try
                myReportDocument.SetDataSource(DsReportData)
                CrystalReportViewer1.ReportSource = myReportDocument
                CrystalReportViewer1.DataBind()
            Catch ex As Exception
                Exit Sub
            End Try
        End Sub

      Private Function FillDataSet(ByVal ReportName As String, ByVal strReportCriteria As String) As DataSet

    ''''''''////////......code to fill the dataset.......//////////// 

    End Function 

    Thursday, April 12, 2007 7:59 AM

Answers

  • User1102436534 posted
    I found the solution to my trouble.  The DataBind() method is not actually necessary in this case.  Removing that one line corrects the zoom issue and does not break my data
    protected void Page_Load(object sender, EventArgs e)
    {
        ReportDocument rd = new ReportDocument();
        rd.Load(Server.MapPath("Reports/TestCrystalReport.rpt"));

        ReportViewer.ReportSource = rd;
    }
    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Monday, July 9, 2007 1:42 PM

All replies

  • User-1509636757 posted

    any body having any idea ?!! 

    Friday, June 8, 2007 9:03 AM
  • User411257011 posted

    I was having this problem also. I finally realized that i wasnt check for postbacks in the page_load event.  Once i caught this, for the "ViewZoom" event i have something like:

    "

    Protected Sub rptViewer_ViewZoom(ByVal source As Object, ByVal e As CrystalDecisions.Web.ZoomEventArgs) Handles rptViewer.ViewZoom

    Me.rptViewer.PageZoomFactor = e.NewZoomFactor

    'Reload the report

    LoadReport()

    End Sub

    "

    Wednesday, June 27, 2007 10:03 AM
  • User-1509636757 posted

    can you send me a sample code for this (crating a simple report with zoom and search (from crystal report toolbar itself))
    thanx in advance. it would be a great help. 

    Thursday, June 28, 2007 12:35 AM
  • User1102436534 posted

    Did you ever solve this?

     I'm having the same trouble.  If my report is embedded then the zoom function works correctly.  If I change it to a non embedded report, zoom breaks in the way you described.

     I tried creating my own zoom function instead of using the programming from the default toolbar but the values passed in for NewZoomFactor and CurrentZoomFactor are the same number (the old one) 

    protected void Page_Load(object sender, EventArgs e)
    {
    
        ReportDocument rd = new ReportDocument();
        rd.Load(Server.MapPath("Reports/TestCrystalReport.rpt"));
    
        ReportViewer.ReportSource = rd;
        ReportViewer.DataBind();
    
    }
     
    Monday, July 9, 2007 12:23 PM
  • User1102436534 posted
    I found the solution to my trouble.  The DataBind() method is not actually necessary in this case.  Removing that one line corrects the zoom issue and does not break my data
    protected void Page_Load(object sender, EventArgs e)
    {
        ReportDocument rd = new ReportDocument();
        rd.Load(Server.MapPath("Reports/TestCrystalReport.rpt"));

        ReportViewer.ReportSource = rd;
    }
    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Monday, July 9, 2007 1:42 PM
  • User-455811767 posted

    hi sarasew

    you have found good solution,its working very nice

    thanks

    ganaparthi

    Tuesday, February 2, 2010 1:44 AM
  • User-117359044 posted

    It worked great as soon as i commented the below line.

    'CrystalReportViewer1.DataBind()

    Actually the DataBind() does not needed now, Check this




    Thursday, July 22, 2010 1:34 PM
  • User-669877521 posted

    Thx for help 

    Wednesday, October 27, 2010 7:06 AM
  • User-669877521 posted

    thx for the solution.

    it works ok for me. 

    Wednesday, October 27, 2010 7:08 AM
  • User1850609860 posted

    its working fine.its very very useful

    Friday, March 16, 2012 7:22 AM