Hello, Support:
Well, I've read numerous posts and help-file entries on parameters, but I must be missing something. I can't get the values of parameters to show up on the report. Perhaps there's something wrong with my workflow on this. My goal is to add four parameters to a report in the designer at design time, and then silently pass in the values at runtime. Here's my workflow:
- Create a report is Visual Studio;
- Create and add parameters, along with other, bound fields;
- Set the visibility of the parameters to "public", and set turn off the requesting of parameters;
- Save down the report into an REPX file;
- In code, do the following (this is just a quick spike to test an idea):
<code lang="cs">
XtraReport faxCoverSheet = new XtraReport();
faxCoverSheet = XtraReport.FromFile(@"C:\Users\Eric\Documents\CompanyDev\DotNET Development\COMPPROJ\Production\BidIt\BidIt\Reports\DefaultFaxCoverSheet.repx", true);
Debug.Assert(faxCoverSheet != null);
faxCoverSheet.Parameters["paramTo"].Value = proposal.Contact.FullName;
faxCoverSheet.Parameters["paramSubject"].Value = email.Subject;
faxCoverSheet.Parameters["paramBody"].Value = email.Body;
email.Body = "{nocoverpage}";
faxCoverSheet.ExportToPdf(@"C:\FaxCoverSheet.pdf");
if (fileAttachments == null)
fileAttachments = new[] { "C:\FaxCoverSheet.pdf" };
else
fileAttachments[0] = "C:\FaxCoverSheet.pdf";
</code
The rest goes on from there to send the email to an Internet-based fax service. No matter what I do, I can't the parameters to show up. And, yes, I've made sure their Visible property is set to true.
What am I doing wrong here?
Thank you.
Eric
Hello Eric,
I've tried to reproduce your issue, but failed, sorry. Your approach seems fine. I've created a sample according to your description, but everything works fine on my side. For reference, see a sample project in the attachment. If possible, please update the report layout to illustrate the problem or describe your scenario in greater detail. Then, I'll check for a solution.
Thank you,
Valery.
Hello Valery,
Thank you for the reply.
Actually, you're example does exhibit the same problem. I think you might have misunderstood #2 of my original post: By "create and add parameters" I meant that I added them in the report designer (so that they showed up in the field list), and then dragged those parameter fields onto the report into a banded region. I noticed that your example does not show any of the parameters in the banded regions of the report. When I drag the parameters you created onto a banded area, and then run your example, none of the data that you supplied to these parameters in code shows up on the report (in the PDF). All I see is the word "Report", which is the static label you created.
To reproduce the problem with YOUR example, do the following:
You will see that the values you supplied to these parameters in code are not displayed in the parameter fields you added to the report in #2 above.
I hope this clarifies.
Thank you.
Eric
Hello Eric,
Thank you for your feedback and clarification. I'm afraid you're referring to an actual XtraReports issue. Therefore, I've converted your question to a bug report and changed its subject. Our developers will continue the research in order to determine what goes wrong. We will keep you informed about our progress.
Thank you,
Valery.
Valery,
O.K. Glad to know I wasn't losing my mind. We probably will need an immediate fix, but I'm in the middle of a pretty substantial refactoring right now. So I have some time. I'll contact support when the need for the fix becomes more pressing.
Thank you for your assistance.
Eric
Thank you! You guys are awesome!
Eric