ReportViewer on UserCotrol
-
Hello, When I'm placing ReportViewer on a from and design a report.rdcl for it, a BindingSource object is automatically generated for me. However' when I place the ReportViewer on a UserControl, the BindingSource object isn't created and no report is displayed. Is it a problem in my logic/code or is it a known limitation ... any how, if you have any kind of suggestions ... I'll be more then happy to listen :) Thanks in advance
-
Hello, When I'm placing ReportViewer on a from and design a report.rdcl for it, a BindingSource object is automatically generated for me. However' when I place the ReportViewer on a UserControl, the BindingSource object isn't created and no report is displayed. Is it a problem in my logic/code or is it a known limitation ... any how, if you have any kind of suggestions ... I'll be more then happy to listen :) Thanks in advance
No data == no report. Did you expect something else? Scott P
“It is practically impossible to teach good programming to students that have had a prior exposure to BASIC: as potential programmers they are mentally mutilated beyond hope of regeneration.” -Edsger Dijkstra
-
No data == no report. Did you expect something else? Scott P
“It is practically impossible to teach good programming to students that have had a prior exposure to BASIC: as potential programmers they are mentally mutilated beyond hope of regeneration.” -Edsger Dijkstra
-
Hi. Why are you picking on on words? :) My real question was wether it was possible to put a reportViewer on a UserControl and how to make the BindingSource object to be created? Thanks again
It is possible to put the ReportViewer on a UserControl, however I don't think it necessary as it already is a control. To bind to objects, you first have to have an object with the data that you want to display. Note that how you want to display the data has an impact on how you should construct the objects. I started with the display, then worked back to the objects that I needed to fill and then created FactoryMethods to process data in my application to fill those "report objects". In the example below, iData.GetHeader() returns a List<Header>. If you're still unsure, you should consider getting a book on report services, it's a broad topic with slim resources on the internet.
ReportDataSource rpd1 = new ReportDataSource("Logic_Header", iData.GetHeader()); ReportDataSource rpd2 = new ReportDataSource("Logic_DataA", iData.GetReportDataA()); ReportDataSource rpd3 = new ReportDataSource("Logic_DataB", iData.GetReportDataB()); viewer.LocalReport.SetParameters(GenerateGenrlReportParams(GetCorrectedFont(myFont))); viewer.LocalReport.DataSources.Add(rpd1); viewer.LocalReport.DataSources.Add(rpd2); viewer.LocalReport.DataSources.Add(rpd3); viewer.RefreshReport();
Scott P“It is practically impossible to teach good programming to students that have had a prior exposure to BASIC: as potential programmers they are mentally mutilated beyond hope of regeneration.” -Edsger Dijkstra
-
It is possible to put the ReportViewer on a UserControl, however I don't think it necessary as it already is a control. To bind to objects, you first have to have an object with the data that you want to display. Note that how you want to display the data has an impact on how you should construct the objects. I started with the display, then worked back to the objects that I needed to fill and then created FactoryMethods to process data in my application to fill those "report objects". In the example below, iData.GetHeader() returns a List<Header>. If you're still unsure, you should consider getting a book on report services, it's a broad topic with slim resources on the internet.
ReportDataSource rpd1 = new ReportDataSource("Logic_Header", iData.GetHeader()); ReportDataSource rpd2 = new ReportDataSource("Logic_DataA", iData.GetReportDataA()); ReportDataSource rpd3 = new ReportDataSource("Logic_DataB", iData.GetReportDataB()); viewer.LocalReport.SetParameters(GenerateGenrlReportParams(GetCorrectedFont(myFont))); viewer.LocalReport.DataSources.Add(rpd1); viewer.LocalReport.DataSources.Add(rpd2); viewer.LocalReport.DataSources.Add(rpd3); viewer.RefreshReport();
Scott P“It is practically impossible to teach good programming to students that have had a prior exposure to BASIC: as potential programmers they are mentally mutilated beyond hope of regeneration.” -Edsger Dijkstra