data from a SQL source), I need to create a report with these requirements:
- it will have a fixed amount of pages, say 15 pages
- each page has a different user interface (say checkboxes, frames, text boxes, labels, circles, squares, etc)
- the data for these pages will come from a data source (that's the only similarity with the old one)
I know this have to be done programatically and NOT using the wizard, my question is how (give me a hint)?
can you provide an example of creating say a text box, a field, adding a page, a label and what not on certain page?
and hooking this textbox with a data source.
regards
9 Answers, 1 is accepted
The detail section repeats items from a bound data in the specified template. If you intend to use one report definition, that means only one template (detail section) will be available. Having in mind the principle of work is like a repeater i.e. the detail section is repeated for each record, creating predefined number of pages with different layout is least to say very tedious work.
In addition, changing the report definition once processing has started is not recommended, so the right way to have 15 different layouts as one is creating 15 different report definitions which will be gathered in one ReportBook control. For more details about using ReportBook, please check the ReportBook example installed under C:\Program Files (x86)\Telerik\Reporting Q3 2012\Examples on your machine. The data source for all reports can be set to the reports before adding them to the ReportBook.
In short, Telerik Reporting or any reporting product in general is not the right choice for your scenario, where you tend to create a document similar to word processing products where each page can be individually designed and different from previous/next.
I hope this helps.
All the best,
Stef
the Telerik team
HAPPY WITH REPORTING? Do you feel that it is fantastic? Or easy to use? Or better than Crystal Reports? Tell the world, and help fellow developers! Write a short review about Telerik Reporting and Telerik Report Designer in Visual Studio Gallery today!
I have a different question. I am new to Telerik reporting. Actually, I am binding the data to the report viewer by using the Telerik report wizard where we can set the stored procedure name. By using this way I am able to bind. But, I don't want to use by this way. I want to bind the data using pro-grammatically in the code behind with the dataset. The output to my stored procedure is XML, so I am converting the xml into dataset. Now, I am binding that dataset to report viewer, but it's not.
For testing purpose, I have binded the dataset to gridview and it's showing me all the data. But, I am not able to do the same with the report viewer.
Dim dsSelected As New DataSet Dim xNodeList As Xml.XmlNodeList = xmlDocument.GetElementsByTagName("detail") Dim xReader As Xml.XmlTextReader Dim x As Integer For x = 0 To xNodeList.Count - 1 xReader = New Xml.XmlTextReader(xNodeList.Item(x).OuterXml, Xml.XmlNodeType.Element, New Xml.XmlParserContext(Nothing, Nothing, Nothing, Xml.XmlSpace.None)) dsSelected.ReadXml(xReader, XmlReadMode.InferSchema) Next xDim objectdatasource As New Telerik.Reporting.ObjectDataSource() objectdatasource.DataSource = dsSelected Dim report As New Telerik.Reporting.Report() report.DataSource = dsSelected Dim source As New Telerik.Reporting.InstanceReportSource() source.ReportDocument = New Report1() ReportViewer.ReportSource = source ReportViewer.DataBind()
@Steve:You are on the right way using objectDataSource. Please, take a look at this help article elaborating on the needed settings to work with DataSet objects: How to: Bind to a DataSet.
@Johannes: glad that our suggestion helps.
All the best,
Stef
the Telerik team
HAPPY WITH REPORTING? Do you feel that it is fantastic? Or easy to use? Or better than Crystal Reports? Tell the world, and help fellow developers! Write a short review about Telerik Reporting and Telerik Report Designer in Visual Studio Gallery today!
I have done the same thing. I can see the dataset data at run-time. But, I am not able to bind to the report viewer pro-grammatically.
I have binded that to a Gridview and it's working. I have sent my code in my earlier post. Can we bind a pro-grammatically returned dataset to a telerik report viewer ?
Appreciate your help on this..
Please test the following code in your project:
' Creating and configuring the ObjectDataSource component:
Dim objectDataSource As New Telerik.Reporting.ObjectDataSource()
' GetData returns a DataSet with three tables
objectDataSource.DataSource = GetAllData()
' Indicating the exact table to bind to. If the DataMember is not specified the first data table will be used.
objectDataSource.DataMember = "SomeTableNameFromTheDataSet"
'Create instance of your report
Dim report As New MyReport()
'assign the data source to the report
report.DataSource = objectDataSource
'create report source instance for the ReportViewer
Dim source As New Telerik.Reporting.InstanceReportSource()
'set your report as document for that report source instance
source.ReportDocument = report
'display the report in the ReportViewer
ReportViewer.ReportSource = source
I hope this solves the issue.
Kind regards,
Stef
the Telerik team
HAPPY WITH REPORTING? Do you feel that it is fantastic? Or easy to use? Or better than Crystal Reports? Tell the world, and help fellow developers! Write a short review about Telerik Reporting and Telerik Report Designer in Visual Studio Gallery today!
'This is my stored procedure name "RptCashManagementBatchAU" which is returning xml. libweBroker is used in our project for the connection string information and from there we are calling the stored procedure.
Dim rslt As Hashtable = libWebBroker.clsWebBroker.RptCashManagementBatchAU(StartDate, EndDate)dsXML.LoadXML(CType(rslt("RptCashManagementBatchAU")(0), System.Xml.XmlDocument).OuterXml) Dim xmlDocument As New XmlDocument() xmlDocument.LoadXml(CType(rslt("RptCashManagementBatchAU")(0), System.Xml.XmlDocument).OuterXml) 'Converting the stored procedure output xml to a dataset. Dim dsSelected As New DataSet Dim xNodeList As Xml.XmlNodeList = xmlDocument.GetElementsByTagName("detail")'Childe node. Dim xReader As Xml.XmlTextReader Dim x As Integer For x = 0 To xNodeList.Count - 1 xReader = New Xml.XmlTextReader(xNodeList.Item(x).OuterXml, Xml.XmlNodeType.Element, New Xml.XmlParserContext(Nothing, Nothing, Nothing, Xml.XmlSpace.None)) dsSelected.ReadXml(xReader, XmlReadMode.InferSchema) Next x'creating the instance for the objectdatasource and then binding the resultant dataset.
Dim objectDataSource As New Telerik.Reporting.ObjectDataSource() objectDataSource.DataSource = dsSelected Dim report As New Report1() report.DataSource = objectDataSource Dim source As New Telerik.Reporting.InstanceReportSource() source.ReportDocument = report ReportViewer.ReportSource = source
I don't think I need to specify the datamember here as my dataset is only returning one table. I have also used by assigning the datamember, but still it's not working.
We've already addressed your inquiry in the other forum thread you have hijacked. Here is our answer:
You instantiate Report1() class, but is that report bound and created by you beforehand? Grid controls are not appropriate comparison, as most of them have the automagical "AutogenerateColumns" property that would iterate your datasource and create columns from it. This would not happen for a template component like Telerik Report, you should create the layout yourself either by manually laying out report items or use the Report Wizard to create the report. See Creating a Simple Report for more information.
If you still need help, it would be best to open a support ticket and attach a project that exhibits the issue, so we can help you accordingly.
All the best,
Steve
the Telerik team
HAPPY WITH REPORTING? Do you feel that it is fantastic? Or easy to use? Or better than Crystal Reports? Tell the world, and help fellow developers! Write a short review about Telerik Reporting and Telerik Report Designer in Visual Studio Gallery today!