Hi,
Working on Demo Project and need to understand the work flow for telerik reports.
1. I create Report Library were i have "RouteCustomerReport.vb" ("Design Only" not connected with any datasource)
2. I have another project where i import ZulalReportLibrary.dll
3. Below Code display the report without data.
Private Sub frmRouteCustomerReport_Load(sender As Object, e As EventArgs) Handles MyBase.Load
Dim rpt As New ZulalReportLibrary.RouteCustomerReport
rpt.DataSource = MyDataSource()
Dim TRS As New Telerik.Reporting.TypeReportSource
TRS.TypeName = "ZulalReportLibrary.RouteCustomerReport, ZulalReportLibrary, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null"
ReportViewer1.ReportSource = TRS
ReportViewer1.RefreshReport()
End Sub
6 Answers, 1 is accepted
Let us start from report sources - Report Sources.
Report Sources are used to specify the format of the report:
- UriReportSource for TRDP and TRDX files without modifications. The reporting engine deserializes the content t of he file at run-time to get a Telerik.Reporting.Report object for processing and rendering;
- TypeReportSource for report classes inheriting Telerik.Reporting.Report (reports created by VS Report Designer) without modifications. The reporting engine uses reflection to create an instance of the report class at run-time by using the report's default parameterless constructor;
- InstanceReportSource for reports created by the VS Report Designer or report instances created/modified at run-time.
If you want to modify reports before displaying them, you will need to use an InstanceReportSource.
In addition, load the report in a Report Designer and check its structure via Report Explorer. If data is visualized by a nested data item (Table/List/Crosstab/Map/Graph), you need to find the item and to set that item's DataSource at run-time e.g.:
Dim
rpt
As
New
ZulalReportLibrary.RouteCustomerReport
Dim
tableItem =
DirectCast
(rpt.Items.Find(
"Table1"
,
True
)(0), Telerik.Reporting.Table)
tableItem.DataSource = MyDataSource()
Dim
IRS
As
New
Telerik.Reporting.InstanceReportSource
IRS.ReportDocument= rpt
ReportViewer1.ReportSource = IRS
.....
Regards,
Stef
Progress Telerik
Hi ,
that's perfect example to understand the InstanceReportSource. thanks for that.
pin this example and in design view example having SQL datasource in both I am facing preview issue. its not as we want to see.
PFA
Based on the screenshots, please test changing the Encoding of the Barcode item in such manner that the longest string from the data source can be presented via barcode e.g. QR barcode - Barcode Types and Specifics.
To avoid the resizing of the Barcode item, you can add a Panel item in the cell and then the Barcode item without Docking and Anchoring. This will make the Panel item resize, but it will keep the design-time size of the Barcode item.
Regards,
Stef
Progress Telerik
Hi Stef,
I have done this in more programmatically, I have form where user can select the route and route_day, by selecting route_day, report display only first day of route. (it means it will reset the index to 1 or 0 first item in the list)
can you please help me why is this happening.
Thanks
Click event code is here
---------------------------------------------------------------------------------------
Dim rpt As New ZulalReportLibrary.RouteCustomerReport
'rpt.DataSource = MyDataSource()
Dim tableItem = DirectCast(rpt.Items.Find("Table2", True)(0), Telerik.Reporting.Table)
tableItem.DataSource = MyDataSource()
Dim IRS As New Telerik.Reporting.InstanceReportSource
IRS.ReportDocument = rpt
Dim report As Telerik.Reporting.Report = DirectCast(IRS.ReportDocument, Telerik.Reporting.Report)
Dim txtTerritory As Telerik.Reporting.TextBox = TryCast(report.Items.Find("txtTerritory", True)(0), Telerik.Reporting.TextBox)
Dim txtRoute As Telerik.Reporting.TextBox = TryCast(report.Items.Find("txtRoute", True)(0), Telerik.Reporting.TextBox)
txtTerritory.Value = " Territory " & drpTerritory.SelectedValue.ToString
txtRoute.Value = " Visiting Route of " & drpRoute.Text
MsgBox("Drp Value" & drpTerritory.SelectedValue.ToString & "-" & "Text Value " & drpRoute.Text)
ReportViewer1.ReportSource = IRS
ReportViewer1.RefreshReport()
-----------------------------------------------------------------------------
Dear Stef,
I got the solution, MyDatasource function resetting the values.
Thanks