ali ahmadi
ali ahmadi

Reputation: 21

Create print page using Stimulsoft and C#

The grid-view that I have is filtered by some options and then it will be passed to a print program named "Stimulsoft" but when the filter is activated, the filtered records are not shown in the print page. The code is shown below:

        StiReport report = new StiReport();
        tbldoreTableAdapter.Fill(doredataset.tbldore);
        tbl_masolTableAdapter.Fill(doredataset.tbl_masol);
        report.Load("Report.mrt");
        report.RegData("DataSourc1", radGridView1.DataSource);
        report.RegData(doredataset.tbldore);
        report.RegData(doredataset.tbl_masol);

        report.Show();

I need the filtered records to be shown in the print page.

Upvotes: 2

Views: 466

Answers (1)

Ehsan Zand
Ehsan Zand

Reputation: 350

You need to pass your query to the report before loading the report.

fisrt, define a variable (E.g. var1) in your report and change your dataset sql command as below:

select * from mytable {var1}

then in your code pass it like this:

StiReport1.Dictionary.Variables("Var1").Value = " where field1 = '" + TextBoxX1.Text + "'";
StiReport1.Compile();
StiReport1.Render();
StiReport1.Show();

P.S.: load your report in a "StiReport" object.

Upvotes: 1

Related Questions