Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to pass parameter in devexpress report

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

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

when I press button1 the following windows apperas and ask me for param1 values having already displayed "kashif" in it with button "Submit" and "Reset" My Problem is: I don't want this window to get opened when i Press button1 rather I want to pass directly "kashif" in it without prompting me for param1 value. testimage

like image 513
kashif Avatar asked Dec 15 '22 18:12

kashif


1 Answers

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();
}
like image 198
Steve Avatar answered Dec 24 '22 20:12

Steve