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

No report preview when using objectdatasource

4 Answers 203 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Kenneth
Top achievements
Rank 2
Iron
Kenneth asked on 18 Apr 2014, 12:06 AM
I’m not able to view the report preview in at design time.  I receive an error saying I need to provide valid data for all parameters.  I’m using an objectdatasource with its datasource set to a data class.  I thought there was a way to provide parameter values for use at design time for just this scenario.  When I right click on the report and view report then right click the parameters and click edit parameters, there is a place for each parameter to provide a constant value, I did that and still I receive the error message.  When I configure the datasource there was a pane in the setup wizard that allowed design time parameters to be added, but I cannot seem to get back to that pane anymore for some reason.  If the data method of the data class were being called with no parameters values then I would get an empty dataset, so it appears that it is not getting that far.  I have the connection string hardcoded in the data class. When I had the report setup with a sqldatasource the preview worked fine

So when using a parameterized method in a dataclass with the objectdatasource is there any way to have the report preview work?

Here is the signature of my data method:
 
    <DataObjectMethod(DataObjectMethodType.Select)> _
    Public Function TransferReportList(ByVal sn As String, _
                                       ByVal tz As Single, _
                                       ByVal transferBy As Integer, _
                                       ByVal sortBy As Short, _
                                       ByVal allDates As Boolean, _
                                       ByVal FromDate As Date, _
                                       ByVal ToDate As Date, _
                                       ByVal direction As Short) As List(Of DataTransfer)
 
 

4 Answers, 1 is accepted

Sort by
0
Stef
Telerik team
answered on 18 Apr 2014, 10:18 AM
Hello Kenneth,

When you use parameterized data retrieval method, you need to map the method's parameters to report parameters e.g. as in the ObjectDataSource Wizard article. The design time parameters values are used just to retrieve the data scheme and populate the available data fields in the report designer for work. The actual values passed to the data retrieval method will be these set to the corresponding report parameters.

Thus to enable the design preview you can use default values for the report parameters, or make them visible. To preview the report in a viewer you can still leave the report parameters visible (they will be displayed the viewer control's Parameters Area), or send parameters values through the Report Source object that wraps the report (the ReportSource.Parameters collection (key-value pairs) is mapped to the underlying Report.ReportParameters collection by key).

If you need further help, please post the code for generating your report definition and some test data records. Feel free to open a support ticket and send us these details in it.


Regards,
Stef
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
0
Kenneth
Top achievements
Rank 2
Iron
answered on 18 Apr 2014, 03:30 PM
Thanks for the reply. I believe I have done all you said..  Attached are screen shots showing the objectdatasource's configure wizard parameters and default values and the resulting error message.  At Run time I use the following to pass the parameters:


Private Sub ReportViewer1_RenderBegin(sender As Object, args As 
Telerik.ReportViewer.Silverlight.RenderBeginEventArgs) Handles 
ReportViewer1.RenderBegin
Dim rp As Report_Storage.ReportParams = 
getReportParams()
args.ParameterValues(
"sn") = 
Application.Current.Resources("sn")
args.ParameterValues(
"tz") = 
-6
args.ParameterValues(
"transferBy") = 
rp.transferBy
args.ParameterValues(
"sortBy") = 
rp.sortBy
args.ParameterValues(
"allDates") = 
rp.allDates
args.ParameterValues(
"FromDate") = 
rp.FromDate
args.ParameterValues(
"ToDate") = 
rp.ToDate
args.ParameterValues(
"direction") = rp.direction
End Sub
0
Kenneth
Top achievements
Rank 2
Iron
answered on 18 Apr 2014, 06:32 PM
Making the parameters visible works, however I don't want the parameters to be visible.  This is fine while I am designing the report though, I just need to remember to make them not visible before I deploy.
0
Kenneth
Top achievements
Rank 2
Iron
answered on 18 Apr 2014, 06:44 PM
Resolved.  I was adding the default parameter values in the objectdatasource's configure wizard, which did not work,  What did work was adding a vlaue to the report parameters by right clicking the report, selecting report parameters and entering an appropriate value in each parameters value field.  This is what Stef was trying to tell me but I was stuck on the objectdatasource.
Tags
General Discussions
Asked by
Kenneth
Top achievements
Rank 2
Iron
Answers by
Stef
Telerik team
Kenneth
Top achievements
Rank 2
Iron
Share this question
or