How to transfer the value of a text field from one web form to xtrareport?

I have a web form where I have a text box in which the user enters a number and retrieves information from the table. Now I have developed xtrareport where I have to display the data from which the user enters this text box, which I mentioned earlier. Everything works fine, but I just need to pass the value of texbox (form1) to the report (form2).

Now I need how to pass the value of the text field as a parameter to the report and display the report data for the selected number.

+3
source share
2 answers
  • (, ).
  • , .

:

                        using (var report = new XtraReport())
                        {
                            report.Bands.Add(new DetailBand());
                            report.Parameters.Add(new Parameter { Name = "userName",ParameterType = ParameterType.String});
                            report.FilterString = "USER = userName";
                            report.SaveLayout("test.repx");
                        }
                        using (var report = new XtraReport())
                        {
                            report.LoadLayout("test.repx");
                            report.Parameters.First(p => p.Name == "userName").Value = textBox.Text;
                            report.ShowPreviewDialog();
                        }


winform. . - .

0

textedit .

 string oper = "A";
 XtraReport_1 report = new XtraReport_1(oper, Convert.ToInt32(TextEdit1.Text));

 ReportPrintTool tool = new ReportPrintTool(report);
 tool.ShowPreview();

, .

XtraReport_1 .

public InvoiceReport_1(string oper, int p)
    {
        // TODO: Complete member initialization
        InitializeComponent();
        InvisibleText.Text = p.ToString();
        InvisibleText.Visible = false;

        getOper = oper;

    }

TextEdit calld "InvisibleText".

0

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


All Articles