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

Strange telerik reporting parameters question from a rookie.

3 Answers 85 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Mirsad
Top achievements
Rank 1
Mirsad asked on 26 Jun 2013, 07:12 AM

Hi. This is probably an easy question for somebody to answer but it is driving a noobie like me nuts tonight. I have a report that has 3 parameters (date_start, date_end, worker). I set up the parameters as usual and assigned some default values to them.   I have some tables that use a sqldatasource to  display some data based on those parameters. This works fine. I have absolutley no isues with the tables displayign data using the parameters

What I am trying to do is use some code behind (presumably in itemdatabound event) to do a calculation and display some text in a textbox based on the number of days between start and end date parameters. I can get this calculated data to display. but it always displays values based on the default value of the parameters and not what is selected in the dropdowns for the parameters. if i clear the default values from the parameters, the report errors out because it thinks the default values for the dates are blank or null.
 
Does the itemdatabound event fire before the parameters are available to use and calculate against?

What should I be doing?

3 Answers, 1 is accepted

Sort by
0
Peter
Telerik team
answered on 26 Jun 2013, 01:41 PM
Hi Mirsad,

Most probably you have used the Report Parameter definition item instead of the processing counterpart. The definition report parameter value is actually the default value. The sender of the event is always the processing counterpart of the data item and you can use it to access the processing report parameter. For more information check out the Using Report Parameters programmatically.

However based on your description it seems that you can utilize user function instead of event.

Regards,
Peter
Telerik

Have you tried the new visualization options in Telerik Reporting Q1 2013? You can get them from your account.

0
Mirsad
Top achievements
Rank 1
answered on 26 Jun 2013, 08:14 PM

Yes, I am using the code below to try and retrieve the user entered parameters but all I can retrieve are the default parameters:

Private Sub detail_ItemDataBound(sender As System.Object, e As System.EventArgs) Handles detail.ItemDataBound
 
 
        Dim Date1 As DateTime = Convert.ToDateTime(Report.ReportParameters("Start").Value).ToShortDateString
        Dim Date2 As DateTime = Convert.ToDateTime(Report.ReportParameters("End").Value).ToShortDateString
        Dim Date1x As DateTime = Convert.ToDateTime(Report.ReportParameters("Start").Value).ToShortDateString
        Dim Date2x As DateTime = Convert.ToDateTime(Report.ReportParameters("End").Value).ToShortDateString
        Dim entered_by As String = (Report.ReportParameters("Servicedby").Value)
0
Accepted
Peter
Telerik team
answered on 27 Jun 2013, 04:35 PM
Hello,

As shown in the Using Report Parameters programmatically help article you can access the processing report parameters as shown in the following code snippet:

Private Sub detail_ItemDataBound(sender As System.Object, e As System.EventArgs) Handles detail.ItemDataBound
        Dim detail = DirectCast(sender, Telerik.Reporting.Processing.Detail)
        Dim Date1 As DateTime = Convert.ToDateTime(detail.Report.Parameters("Start").Value).ToShortDateString

Regards,
Peter
Telerik

Have you tried the new visualization options in Telerik Reporting Q1 2013? You can get them from your account.

Tags
General Discussions
Asked by
Mirsad
Top achievements
Rank 1
Answers by
Peter
Telerik team
Mirsad
Top achievements
Rank 1
Share this question
or