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

Connect dataset to WinForms report viewer

1 Answer 111 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
sung yeol
Top achievements
Rank 1
sung yeol asked on 26 Sep 2018, 12:56 PM

 

I have imported a dataset.

    ' Creating and configuring the ObjectDataSource component:
            Dim objectDataSource As New Telerik.Reporting.ObjectDataSource()
            objectDataSource.DataSource = GetData() ' GetData returns a DataTable

I have already drawn up a report with the appropriate dataset.

  Dim clientReportSource As New Telerik.ReportViewer.Html5.WebForms.ReportSource
            clientReportSource.IdentifierType = Telerik.ReportViewer.Html5.WebForms.IdentifierType.TypeReportSource
            clientReportSource.Identifier = "report2.trdp"

 

   reportViewer1.ReportSource = clientReportSource

 

I do not know how to connect the dataset I imported to the report source.

-------------------

Fix my source  Thanks ^^;

-------------------

What I want is simple

1. Create the dataset I want.
2. Draw a report that has a field in the dataset.
3. Display it.


I finished 1 GetData()  , I finished 2. ( "report2.trdp" ) 

Now you need to concatenate and display the data as in # 3.
But I did not solve it.

 

 

 

 

1 Answer, 1 is accepted

Sort by
0
Nasko
Telerik team
answered on 01 Oct 2018, 09:02 AM
Hello sung yeol,

The whole Telerik.ReportViewer.Html5.WebForms namespace is responsible for the report viewer and happens on the client side.

The whole Telerik.Reporting.ObjectDataSource class which is responsible for data retrieval happens on the server side.

This is why you are unable to pass this data to the report, as the data might not even be serializable.

The recommended practice to control the data passed to the report is by configuring the ObjectDataSource at design-time of the report (using a report designer tool) and controlling it at run-time by passing values to its report parameters.

However, if you would still like to do all of the work programmatically, you can create the data set and pass it to a report object inside a custom report resolver. Note that the custom report resolver should return a report source, which in your case should be an InstanceReportSource as you are using and modifying a report object instance.

Regards,
Nasko
Progress Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Tags
General Discussions
Asked by
sung yeol
Top achievements
Rank 1
Answers by
Nasko
Telerik team
Share this question
or