How to pass parameter in devexpress report

I am using Devexpress XtraReport in a Windows application for reporting purposes. I set param1 parameter, having the string as type in my XtraReport1 and using the following code to pass the parameter.

private void button1_Click(object sender, EventArgs e) { XtraReport1 report = new XtraReport1(); report.Parameters["param1"].Value = "kashif"; report.Print(); } 

when I press button1 on the next apperas windows and ask me for param1 values ​​that already displayed “kashif” in it using the “Send” and “Reset” buttons, My problem: I do not want this window to open when I press button1 instead, I want to pass directly "kashif" in it, without asking me for the value of param1. testimage

+4
source share
2 answers

From their documentation here How to do: Powerfully pass the parameter value

Add a parameter to a report, set the parameter Modifiers property to Public, and disable the parameter Parameter.Visible property. When there are no visible parameters in a report, their values are passed "silently" (without exposing the Parameters UI to end-users).

 private void button1_Click(object sender, EventArgs e) { // Create a report instance. XtraReport1 report = new XtraReport1(); // Obtain a parameter, and set its value. report.parameter1.Value = 30; // Hide the Parameters UI from end-users. report.parameter1.Visible = false; // Show the report print preview. report.ShowPreview(); } 
+11
source

You may like this ** (Asp.net Mvc Razor)

 Invoice report = new Invoice(); public ActionResult InvoiceViewerPartial() { using (CrmDbContext db = new CrmDbContext()) { report.DataSource = db.InvoiceItem.ToList(); } report.Parameters["InvoiceId"].Value = "Inv0003"; return PartialView("_InvoiceViewerPartial", report); } 
0
source

Source: https://habr.com/ru/post/1437535/


All Articles