report parameter not holding

4 posts, 0 answers
  1. Bruce
    Bruce avatar
    23 posts
    Member since:
    Sep 2008

    Posted 03 Aug 2011 Link to this post

    on the web form, the parameter holds, but on the reporting library, it does not. what am i dont wrong here?

    CampRegistration.vb

       Public Sub New()
            InitializeComponent()

            'Me.ReportParameters("campdateid").Value = 7 'default here

            Me._campdateid = Me.ReportParameters("campdateid").Value

            'Me.TextBox1.Value = Me.ReportParameters("campdateid").Value.ToString


            Me.cdbll.connectionString = bo.Constants.ConnectionString
            Me.rbll.connectionString = bo.Constants.ConnectionString
            
        End Sub

        Private _campdateid As Integer = 0

        Private _contactlist As System.Data.DataTable = Nothing

        Private cdbll As New dal.CampDate()
        Private rbll As New dal.Registration

        Private _registrations As DataTable = Nothing



        

        'Private Sub SubReport1_NeedDataSource(ByVal sender As Object, ByVal e As System.EventArgs) Handles SubReport1.NeedDataSource
        '    Dim subReportItem As Telerik.Reporting.Processing.SubReport = TryCast(sender, Telerik.Reporting.Processing.SubReport)


        '    subReportItem.InnerReport.DataSource = Me._contactlist
        'End Sub

     
        Private Sub CampRegistration_NeedDataSource(ByVal sender As ObjectByVal e As System.EventArgs) Handles Me.NeedDataSource

            ' Exit Sub

            '---initial title of report
            Dim cd As acmilan.bo.CampDate = cdbll.getCamp(Me._campdateid)

           

            If cd IsNot Nothing Then
                Me.TextBox1.Value = cd.name & " @ " & cd.city & ", " & cd.state
                Me.TextBox3.Value = cd.start.ToLongDateString & " to " & cd.end.ToLongDateString
            End If
            
            Try

                '---get registrations for campdate
                Me._registrations = Me.rbll.getAllForCampDate(Me._campdateid)
                TryCast(sender, Telerik.Reporting.Processing.Report).DataSource = Me._registrations


                 
            Catch ex As Exception
                'Me.TextBox1.Value = ex.StackTrace & ex.Message
            End Try


        End Sub


    Report.aspx.vb
      Protected Sub Page_Load(ByVal sender As ObjectByVal e As System.EventArgsHandles Me.Load
            If Not IsPostBack Then
                Dim repReport As New thunder.apps.acmilan.reports.CampRegistration
                Dim cdbll As New bll.CampDate(thunder.framework.dal.sql.DataAccess.rMethod.ObjectList)


                Dim id As Integer = Convert.ToInt32(Request.QueryString("campdateid"))
                Dim cd As bo.CampDate = cdbll.getCampdate(id)

                If cd IsNot Nothing Then
                    Me.HyperLink1.NavigateUrl = "campprofile.aspx?campid=" & cd.campid.ToString
                    repReport.DocumentName = cd.name & "Camp_Registration_Report_" & id.ToString
                    repReport.ReportParameters("campdateid").Value = id

                    Me.ReportViewer1.Resources.ProcessingReportMessage = "Generating Camp Registration ID" & repReport.ReportParameters("campdateid").Value.ToString

                    Me.ReportViewer1.Report = repReport
                    Me.ReportViewer1.DataBind()
                    Me.ReportViewer1.RefreshReport()



                Else

                End If

            End If
        End Sub


  2. Steve
    Admin
    Steve avatar
    10941 posts

    Posted 08 Aug 2011 Link to this post

    Hello Bruce,

    The provided information is insufficient for us to determine what is the problem you're reporting. Can you elaborate on it and/or provide a sample that exhibits the issue, so we can run it locally and advise you accordingly?

    Best wishes,
    Steve
    the Telerik team

    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get now >>

  3. DevCraft banner
  4. Bruce
    Bruce avatar
    23 posts
    Member since:
    Sep 2008

    Posted 08 Aug 2011 Link to this post

    basically, the parameter value seemed to not be present during the initializing component procedure in the class. i moved the assignment of the parameter into the _needdatasource procedure, and it fired away perfectly.

    i thought i had prior projects that assigned parameter values locally in that initial procedure just fine.
  5. Steve
    Admin
    Steve avatar
    10941 posts

    Posted 09 Aug 2011 Link to this post

    Hello Bruce,

    The report parameters' values are not yet available in the report constructor and this is expected. If you abstract yourself from the fact that you work with 3rd party product and look to the reports as standard .NET classes (which they are), it's like initializing a property and trying to use it inside the class constructor.

    All the best,
    Steve
    the Telerik team

    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get now >>

Back to Top