This is a migrated thread and some comments may be shown as answers.

report parameter not holding

3 Answers 80 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Bruce
Top achievements
Rank 2
Bruce asked on 03 Aug 2011, 05:12 PM
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


3 Answers, 1 is accepted

Sort by
0
Steve
Telerik team
answered on 08 Aug 2011, 02:51 PM
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 >>

0
Bruce
Top achievements
Rank 2
answered on 08 Aug 2011, 02:57 PM
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.
0
Steve
Telerik team
answered on 09 Aug 2011, 04:49 PM
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 >>

Tags
General Discussions
Asked by
Bruce
Top achievements
Rank 2
Answers by
Steve
Telerik team
Bruce
Top achievements
Rank 2
Share this question
or