0
我正在使用Windows窗體應用程序,在窗體應用程序中單擊按鈕後,要將報告加載到報告查看器中。 這是獲取由代碼按下按鈕上的Windows窗體的背後觸發事件:Telerik將WindowsForm Codebehind中的參數報告到報告
private void button1_Click(object sender, EventArgs e)
{
Telerik.Reporting.InstanceReportSource reportSource = new
Telerik.Reporting.InstanceReportSource();
reportSource.ReportDocument = new Reportlibrary.Report1();
reportSource.Parameters.Add(new Telerik.Reporting.Parameter("OrderNumber","123456789"));
reportViewer1.ReportSource = reportSource;
reportViewer1.RefreshReport();
}
現在的問題是,我不知道我怎麼能訪問/獲取我刷新之前添加參數Reportviewer。 報告已經設置了數據源。我不知道這是否重要。 這就是我現在所擁有的。我試過了所有的東西,我只是沒有進一步。
public Report1()
{
InitializeComponent();
Position[] all = new Position[]{
new Position("Test", "Test","test"),
};
this.DataSource = all;
MessageBox.Show("Number: " +
this.Report.ReportParameters["OrderNumber"].Value.ToString());
}
有沒有什麼辦法讓InitializeComponent(); ? 我是否需要向報告添加其他事件才能訪問它?如果是,哪一個是最好的辦法呢?
任何幫助非常apreciated。 謝謝