how to pass parameter in devexpress report

点点圈 提交于 2019-12-01 06:35:45

From their documentation here How To: Silently Pass a Parameter Value

Add a parameter to a report, set the parameter's Modifiers property to Public, and disable the parameter's 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's print preview.
    report.ShowPreview();
}

You can 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);
}
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!