I am attempting to embed a subreport within a master report following the steps outlined in the documentation: How to: Create a Master-Detail Report using Subreports
The report runs without displaying the data for the subreport.
Here is the pertinent information:
Sub report's BeforPrint Event handler:
private void xrSubreport2_BeforePrint(object sender, System.Drawing.Printing.PrintEventArgs e)
Filter String of the sub report's Report: [OversightID] = ?ParamOversightID
Declaration of the parameter:
Visible = false
Type = Int32
Name = ParamOversightID
Modifiers = Public
I temporarily turned the parameter on: Visible = true and ran the sub rejport standalone in the preview mode. I manually entered parameter values and the sub report ran okay. Also i am able to run the master report okay (the sub report simply does not display).
THE PAGE HEADER OF THE SUBREPORT DOES DISPLAY. So i know the subreport is connecting.
My suspicion is that the event handler is wrong.
No problem at all. It looks like you are trying to render the main report using the Preview option in Visual Studio. Please note that all code-behind event handlers are not effective in this situation. You might need to handle the Form.Load event and create an XtraReportMain instance. This way, you should be able to display the main report using its ShowPreview method.If you need to see changes both at design time and at runtime, please use the XtraReports' scripting technology, and move all event handlers to scripts.
To learn more, check the Scripting Overview documentation article.
I have run the report inside of my main program. I get the same result as when i am in the designer. I also tested by having my labels in the sub rejport show (setting the report property to show up on empty data). For each master record i see the sub report's labels but no data is loaded.
As a side note: I have also tested by trying the detail band method and also i get no data.
This is rather strange. I do not have VistaDB installed on my machine. However, I have managed to replace the report's datasource using the common Northwind database.
Attached is a sample project that works fine here. Please review it and let me know whether or not this helps.
Is your intention to post an answer to your own question?
- If so, then proceed.
- If you simply wanted to post additional information, ask for further clarification, or to just say "Thanks!", please click Leave a Comment.
- If you wish to edit your original question, please use the Edit button in the Toolbox at the top right corner of that entry.